The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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 01:43 PM
cron jobs not run robertsnoog Linux 4 02-13-2007 12:24 PM
Cron Jobs Remi SUN Solaris 2 01-03-2007 07:12 PM
Cron Jobs lewisoco SUN Solaris 6 09-04-2005 11:14 AM
CRON Jobs eludlow UNIX for Dummies Questions & Answers 4 05-28-2004 08:24 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-21-2006
siegfried siegfried is offline
Registered User
  
 

Join Date: Oct 2005
Posts: 91
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
  #2 (permalink)  
Old 04-21-2006
DogDay's Avatar
DogDay DogDay is offline
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.
  #3 (permalink)  
Old 04-21-2006
siegfried siegfried is offline
Registered User
  
 

Join Date: Oct 2005
Posts: 91
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
  #4 (permalink)  
Old 04-21-2006
DogDay's Avatar
DogDay DogDay is offline
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.
  #5 (permalink)  
Old 04-21-2006
rajeeb_d rajeeb_d is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 37
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:41 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0