Restarting automatically I would think wouldn't be possible without some outside source checking for whether it is running (for instance crond like you mention). Generally with a daemon process you would right a lock file or pid file, then have cron check for the pid file, read the pid out of it, and use one of the various process table modules to check that pid. pid is process id for those not used to that name. Should also be able to trap the various signals and have a message passed to another script, or email, etc. to notify that the process has collapsed and will need to be restarted.

As for making it run constantly there is always

while(1) {
# do your stuff here
}

You might want to read up on IPC and daemons or services.

http://danconia.org

Octavian Rasnita wrote:
Hi all,

I want to make a Perl program that runs permanently without stopping.
How can I do this?

I could run the program from shell using:

nohup perl script.pl &

..... but if for some unknown reasons the process will be stopped, it won't
restart automaticly.

How can I make it to start automaticly after stopping?

If I will use a cron job, how can I verify if the process is running, to
decide if I need to start it or not on ... lets say each hour?

Thank you.


Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to