The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Please help me with the run-away cron jobs dedema UNIX for Dummies Questions & Answers 2 09-13-2007 10:43 AM
cron jobs not run robertsnoog Linux 4 02-13-2007 09:24 AM
Cron Jobs Remi SUN Solaris 2 01-03-2007 04:12 PM
Cron Jobs lewisoco SUN Solaris 6 09-04-2005 08:14 AM
CRON Jobs eludlow UNIX for Dummies Questions & Answers 4 05-28-2004 05:24 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 04-21-2006
Registered User
 

Join Date: Oct 2005
Posts: 86
How to submit cron jobs?

How can I write a script to submit a perl script as a cron job but only have it execute once?

After it has executed once, I would like it to automatically insert itself again into cron.

I want to avoid the situation where I schedule a cron job to run once a day, but end up with multiple instances of the cron job because it requires more than 24 hours to execute.

Thanks,
Siegfried
Reply With Quote
Forum Sponsor
  #2  
Old 04-21-2006
DogDay's Avatar
Registered User
 

Join Date: Jun 2005
Location: /dev/null
Posts: 83
just have your perl script check to see if it is already running. if so then don't run.
Reply With Quote
  #3  
Old 04-21-2006
Registered User
 

Join Date: Oct 2005
Posts: 86
How do I check to see if it is still running?

Let is supposed I set a flag in a database and I clear the flag when the perl script exits.

What happens if the perl script access violates and executes before it clears the flag?

Then I will never run thinking I am already running!

Thanks,
Siegfried
Reply With Quote
  #4  
Old 04-21-2006
DogDay's Avatar
Registered User
 

Join Date: Jun 2005
Location: /dev/null
Posts: 83
Install a signal handler that looks for SIGINT, or whatever, and delete the file there. I don't program for a living so I can't give you expert advice there.
Reply With Quote
  #5  
Old 04-21-2006
Registered User
 

Join Date: Feb 2006
Posts: 34
Just an idea

Put your job in a loop inside a shell script. Trap your error of your perl script in the loop. Put this shell script on cron.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:09 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0