bash - handling hanging shell command in ruby -
i have cronjob runs ruby scrip collects data bash utility (ipmitool). utility hangs, causing whole script hang, causing cron jobs stack up...
the line of code is:
'macaddress' => `timeout 5 ipmitool lan print | grep 'mac address'`.split(':',2)[1].strip
in cron job still causes script hang when manually test following in ruby script & run form terminal:
ans = `timeout 1 sleep 20 | grep 'hello'`
the shell command terminates
how can prevent cron script hanging?
edit: here's strace of hanging (hang @ select) :
open("/root/.freeipmi/sdr-cache/sdr-cache-xxxx.localhost", o_rdonly) = 4 mmap(null, 2917, prot_read, map_private, 4, 0) = 0x7f0ea2dfd000 ioctl(3, ipmictl_send_command, 0x7fff74802020) = 0 select(4, [3], null, null, {60, 0}
Comments
Post a Comment