Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 22 lines (17 sloc) 469 Bytes
#!/usr/bin/env ruby
# Babysit a process (if it dies, just restart it again).
def now; Time.now.strftime("%D %H:%M:%S") end
if ARGV.size == 0 || ARGV[0] !~ /^\d+$/
puts "Usage: <seconds to pause between executions> <cmd> ..."
exit 1
end
pause = ARGV.shift.to_i
idx = 0
while true
idx += 1
puts "#{now} === STARTING PROCESS ##{idx}: #{ARGV.join(' ')}"
system(*ARGV)
puts "#{now} === PROCESS ##{idx} TERMINATED: #{ARGV.join(' ')}"
puts
sleep pause
end
Something went wrong with that request. Please try again.