run a process
Cathey, Jim
jcathey at ciena.com
Wed Mar 31 20:06:16 UTC 2010
Processes that auto-background (daemonize, i.e. don't block)
can't be debugged easily, and are IMHO kind of a bad idea.
Usually such things have a -f (or some such) to tell them
not to fork off a background identity. Just do that, and
then watch it/respawn it normally?
If it has no way to easily wait() for it, then it's truly evil.
You don't want to run such bad code anyway...
-- Jim
-----Original Message-----
From: busybox-bounces at busybox.net [mailto:busybox-bounces at busybox.net]
On Behalf Of Rob Landley
Sent: Wednesday, March 31, 2010 12:50 PM
To: murali at uczen.co.kr
Cc: busybox at busybox.net
Subject: Re: run a process
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
_______________________________________________
busybox mailing list
busybox at busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
More information about the busybox
mailing list