I'm kinda curious why all the work?
The system function is merely a glorified wrapper around fork and exec anyway, complete with a wait. If you want it to daemonise and ignore signals, just add a few characters:perl -e 'system(@ARGS) while 1' your program with args here
Ok, that's not quite the same as daemonising, but it's often close enough for most purposes.nohup perl -e 'system(@ARGS) while 1' your program with args here &
Now, if the program you're trying to monitor goes and daemonises itself, well, then you have a completely different problem which I don't think anyone has addressed. In that scenario, you probably want to use pgrep (which solves the "grep finding itself" problem for you) in a similar structure to what you have. However, don't use backticks when system will do. Just a bad idea.
In reply to Re: running program?
by Tanktalus
in thread running program?
by rsiedl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |