[SUMMARY] Executing a cron job every second !

From: Levi Ashcol <leviashcol_at_hotpop.com>
Date: Sat Feb 22 2003 - 06:06:47 EST
Original Post is below. 
I received tons of replies. Thanks to all who responded, too many to
list.
Special thanks to Walt Sullivan who send a detailed script to restart a
dying daemon.

- cron's granularity is in minutes, it would be a little silly for 
  cron to wake up every second and cron is not really designed for such
frequent runs.
- Just write a loop-forever script and 'sleep 1' at the bottom of the
loop.
  while [ true ]; do
   sleep 1
    if [ -z "`ps ax | grep <proc> | grep -v grep`"]; then
     #start daemon
    fi
  Done

-why not start the daemon from inittab,using the respawn option? 
 you'd want to use something like:
   dm:234:respawn:/path/my_daemon
 This will cause init to continually check for the presence of my_daemon
and
 start my_daemon if it's not running whenever the system is in run level
2,
 3, or 4.  See inittab(4) for more details.
 You will need to tell the init process to reread /etc/inittab after you
make
 your changes by issuing the command "init q".

- make sure you have the env set properly for the script so as * * * * *
myscript works.
  things like: PATH, LD_LIBRARY_PATH and other needed by the software.

Thanks all.

Levi.



-----Original Message-----
From: sunmanagers-admin@sunmanagers.org
[mailto:sunmanagers-admin@sunmanagers.org] On Behalf Of Levi Ashcol
Sent: 19 February, 2003 1:52 AM
To: sunmanagers@sunmanagers.org
Subject: Executing a cron job every second !


Hi Gurus,
Anybody knew how to put a script in crontab and let it run every second
? 

It is a script that checks if a certain daemon is running or not, if not
it starts it. 

(it is a bug in a software and its developers are working for a
solution, until they finish with the fix we need to run this check
script every second as a workaround ! 

P.S: I have tried this:

* * * * * /usr/local/bin/myscript 

to try to run it at least every min but this also did not work !!!

IWS

Thanks

Levi
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Sat Feb 22 06:10:46 2003

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:03 EST