LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-03-2005, 09:04 AM   #1
bujecas
Member
 
Registered: Oct 2004
Location: Portugal
Distribution: Debian, Slackware
Posts: 78

Rep: Reputation: 20
outdated cronjobs


Hello, I have some scripts running in a cronjob. One of them runs at 07:00. The machine shuts down at 05:00 and reboots at 10:00. The cronjob of 07:00 didn't start.

It's possible to run the outdated cronjob when the machine reboots? How?

note: I'm using vixie cron.
 
Old 08-03-2005, 09:21 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
Is this a daily thing or ongoing reboot type thing? If so, why dont you just move your crons that should be running during downtime to another time? If not and only a rare occasion, just manually run them would be the easiest way.
 
Old 08-03-2005, 11:13 AM   #3
bujecas
Member
 
Registered: Oct 2004
Location: Portugal
Distribution: Debian, Slackware
Posts: 78

Original Poster
Rep: Reputation: 20
It's a daily thing. The problem is that I want the outdated script running when the machine comes up and I may not be available at that time. I want that the machine launch the script automaticaly, not by my hand.
 
Old 08-03-2005, 03:57 PM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
Quote:
Originally posted by bujecas
It's a daily thing. The problem is that I want the outdated script running when the machine comes up and I may not be available at that time. I want that the machine launch the script automaticaly, not by my hand.
If you have your machine shutdown at 05:00 and rebooted at 10:00, why not have the cron kickoff at like 10:10? If you know your system is down for 5 hours each day, I find it pointless to work around any cron jobs you have setup to run during that time when the machine isn't even running. Why make things harder than they have to be?

Or if you definitly want these to run right at bootup, why not set them up in your startup scripts?? I think your making this more complicated than it really is.
 
Old 08-04-2005, 04:35 AM   #5
bujecas
Member
 
Registered: Oct 2004
Location: Portugal
Distribution: Debian, Slackware
Posts: 78

Original Poster
Rep: Reputation: 20
Your're not getting my point. The machine doesn't shuts down every day at 05:00 and boots at 10:00, that was an example. The point is if the power fails and the machine goes down for a indeterminated period, there must be a mechanism to start the cronjobs that were supposed to run at that dead period.
 
Old 08-04-2005, 10:17 AM   #6
Vgui
Member
 
Registered: Apr 2005
Location: Canada
Distribution: Slackware
Posts: 496

Rep: Reputation: 31
You could write a quick script to just run _all_ cron jobs on a reboot, or try to figure out (based on the current time and the last shutdown time) if any didn't get run.
I'd say it's doable through bash scripting though, but there isn't a magic program (that I'm aware of) that can "queue" up cron jobs or anything like that.
 
Old 08-04-2005, 10:24 AM   #7
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
Quote:
Originally posted by bujecas
Your're not getting my point. The machine doesn't shuts down every day at 05:00 and boots at 10:00, that was an example. The point is if the power fails and the machine goes down for a indeterminated period, there must be a mechanism to start the cronjobs that were supposed to run at that dead period.
I guess when you say: "It's a daily thing" kind of threw me off thinking that it actually happens daily..

Well, you'll need to write a script that checks what crons ran and which one's didn't during a downtime period.. verify against the times in your crontab and then most likely in the logs. Then have that script run at startup to verify and run what is necessary, etc. But you'll definitly need to make sure all your cron jobs create some type of output in a log or make the script check when the last time the server shutdown and then started up, take that downtime period and check it against your cron entries and kick off anything that fell in that downtime window..
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Taking auto screenshots using cronjobs Ephracis Linux - General 2 02-24-2006 08:46 AM
manage PHP-cronjobs with apache didi86 Linux - Networking 3 02-20-2005 03:24 PM
facing problem with cronjobs manojthakkar Linux - General 7 12-09-2003 11:55 PM
is there a way to stop cronjobs mail for certain acticities manojthakkar Linux - General 5 12-08-2003 10:56 PM
Outdated GLib? nocturnal Linux - General 1 05-07-2003 05:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration