Re: Help with Cron pleazzzzzzzzzzzz



Quoting Mike Jeays <mike.jeays@xxxxxxxxxx>:
On October 31, 2007 07:58:21 am VeeJay wrote:
I am running a status script written in Perl (*status.pl*) and want to have
it *Always Running*.

How can I check through CRON that "status.pl" is running and if NO, then
start the script execution again?

Please help and advise...

You could write a shell script something like:

A couple nits:

#!/bin/bash

#!/bin/sh

ps -ax | grep 'status.pl'

This should probably be something like "ps -ax | grep 'status.pl' | grep -v grep" so you don't get false positives from the grep process itself.

JN

if [ $q -eq 0 ]
then
status.pl
fi

grep will return zero if it finds a line containing 'status.pl', and 1
otherwise.

in crontab, use

* * * * * /full/path/to/script-above

and it will check every minute.

But a better fix would be to find the bug in status.pl that makes it crash!




--
Mike Jeays
http://www.jeays.ca
_______________________________________________
freebsd-questions@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"




_______________________________________________
freebsd-questions@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: cron and command quote
    ... PS. I'm sure the PATH is setup properly in my cron, ... * replace the command with a shell script which executes the command in a shell ... which grep ...
    (Debian-User)
  • Re: weather warning applet
    ... John Wendel wrote: ... grep <your city or area> 'national.php?prod=WSW' ... Do it in a cron once an hour ...
    (Fedora)
  • Re: How do I schedule a task to be done hourly.
    ... Mark Healey writes: ... to have the script run hourly but cron only seems to go to daily. ... ps aux | grep cron| grep -v grep ...
    (comp.os.linux.misc)
  • Re: rdate, ntp configuration
    ... Or just grep for rdate and see what you get. ... Nothing of either What screwes with my head is, the error is from cron, ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)