run a process
Rob Landley
rob at landley.net
Wed Mar 31 19:49:56 UTC 2010
On Tuesday 30 March 2010 22:24:21 Murali K. Vemuri wrote:
> unfortunately, my process does not block. So, I cannot use "watch" on
> it.
> is there any alternative applet to do this?
>
> Thanks & regards
> Murali
So you have a process that doesn't block, but is randomly dying. Huh.
Ok, you can write a program that will do an inotify to monitor its /proc/$PID
direectory and if that directory is deleted, respawn the process, find the PID
of the new one, do an inotify monitor on _that_, and repeat. (Or you can just
wimp out and do something like:
while true
done
[ -z "$(pidof myprogname)" ] && myprogname
sleep 60
done
Really, if you can get your process to block life becomes much easier. You
can always background a blocking process, but externally monitoring a non-
blocking one is painful, you wind up busy-waiting or doing strange things with
/proc and hoping the current kernel version supports it.
Also, if the process you're monitoring is randomly dying, what makes you think
the process doing the monitoring won't randomly die as well? Sounds like
either your system's unstable or the process you're monitoring is buggy.
Rob
--
Latency is more important than throughput. It's that simple. - Linus Torvalds
More information about the busybox
mailing list