The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 02-04-2008
Raynon Raynon is offline
Registered User
  
 

Join Date: Sep 2006
Location: Sg
Posts: 350
Quote:
Originally Posted by Smiling Dragon View Post
Depends on your cron implementation but generally it will run another copy of the script 10 mins after the first one is started - regardless of how long the first run takes.

Solutions:
  • Make your script reentrant - ie write it such that it running multiple times at once isn't a problem.
  • Make your script aware of how many times it's currently running - ie create a lock file when it starts up and check for this every time you start.
  • Don't use cron, have the script run continuously and manage it's own scheduling - ie sleep 600
  • Don't use cron, get a better scheduler - depending on your enviornment, this could be something like anacron or control-m.

Hi,

Running the script continously means to say that i have to leave a command prompt window always open. Once closed, the process will be ended, and also another disadvantage is that a infinite looping script will eat up alot of resources, wouldn;t it ?
So i still think cron is the more practical one. But i have no idea about anacron or control-m. Can you enlightened me on that ?

Can you give an example of script being re-entrant ?
I was thinking if i could make the script check for the process to see if the previous process have been completed, can any experts give me some examples of this ? I am using csh by the way.