Sha256: 2a85b271763a121f926e1de131d396551100b27f65f028866096e64f85c228aa
Contents?: true
Size: 481 Bytes
Versions: 1
Compression:
Stored size: 481 Bytes
Contents
#!/usr/bin/env ruby require 'socket' if ARGV.length < 2 puts 'is_master execute a command when it determine that server is master' puts "Usage: #{$PROGRAM_NAME} VIP COMMAND" puts ' VIP - IP address expected to be master' puts ' COMMAND - Command to execute if host is master' exit 2 end vip = ARGV[0] command = ARGV[1..-1].join(' ') if Socket.ip_address_list.map(&:ip_address).include?(vip) Kernel.exec(command) else puts 'OK - I am slave, i going to sleep' end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
is_master-1.0.0 | bin/is_master |