I have set up cron jobs to back up my system (thanks to those who recently posted links about this!). However, crontab entries are only (IIUC) executed when the values match the current time and date. Unfortunately, my box would thus go unbacked up if it wasn't turned on at the specified time. Specifically, I have a script that moves the weekly system backups over to a monthly archive. This is set to run on the first of each month. However, if (for example) this was a weekend, the computer might not be on. So, my question - is there a way to set things up so that a script will be run on a specific date or as soon after that as the computer is turned on? Even better, is it possible to set it up so that the script would run at a specified time (outside the working day) on the specified day or the first day thereafter (but at the specified time of day)? TiA John -- John Pettigrew Headstrong Games john@headstrong-games.co.uk Fun : Strategy : Price http://www.headstrong-games.co.uk/ Board games that won't break the bank Knossos: escape the ever-changing labyrinth before the Minotaur catches you!
-----Original Message----- From: John Pettigrew [mailto:john@xl-cambridge.com] Sent: Monday, February 17, 2003 12:17 PM To: suse-linux-e@suse.com Subject: [SLE] Cron question
I have set up cron jobs to back up my system (thanks to those who recently posted links about this!). However, crontab entries are only (IIUC) executed when the values match the current time and date. Unfortunately, my box would thus go unbacked up if it wasn't turned on at the specified time.
Specifically, I have a script that moves the weekly system backups over to a monthly archive. This is set to run on the first of each month. However, if (for example) this was a weekend, the computer might not be on.
So, my question - is there a way to set things up so that a script will be run on a specific date or as soon after that as the computer is turned on? Even better, is it possible to set it up so that the script would run at a specified time (outside the working day) on the specified day or the first day thereafter (but at the specified time of day)?
Why not leave the machines on all the time! You could set up the script cron is going to run so that everytime it completes the backup, some file is updated with the date and time the last backup was made, then the script could check this file and if too much time has passed, do another backup. Best bet would be to leave the machine running 24/7. -- Chris Geske LIMS Manager / Northern Lake Service, Inc. ph: 715-478-2777 email: lims@newnorth.net
In a previous message, Chris Geske wrote:
Why not leave the machines on all the time!
Because it's fairly noisy and is next to my bedroom! Not everyone is interested in running an always-on linux box. Some of us just need a desktop machine for office hourse... John -- John Pettigrew Headstrong Games john@headstrong-games.co.uk Fun : Strategy : Price http://www.headstrong-games.co.uk/ Board games that won't break the bank Valley of the Kings: ransack an ancient Egyptian tomb but beware of mummies!
On Mon, 17 Feb 2003 19:32:57 GMT
John Pettigrew
In a previous message, Chris Geske wrote:
Why not leave the machines on all the time!
Because it's fairly noisy and is next to my bedroom!
Not everyone is interested in running an always-on linux box. Some of us just need a desktop machine for office hourse... You canb't do it directly with cron, but set up a script to check the last time you were backed up, and set the cron to run at various times.
There is another version of cron that is designed specifically for laptops that are not always on, just like this computer. Unfortunately I can't remember the name, but a search on freashmeat might help. -Stathis. Jerry Feldman wrote:
On Mon, 17 Feb 2003 19:32:57 GMT John Pettigrew
wrote: In a previous message, Chris Geske wrote:
Why not leave the machines on all the time!
Because it's fairly noisy and is next to my bedroom!
Not everyone is interested in running an always-on linux box. Some of us just need a desktop machine for office hourse... You canb't do it directly with cron, but set up a script to check the last time you were backed up, and set the cron to run at various times.
------------------------------------------------------------------------ Part 1.2Type: application/pgp-signature
On Monday 17 February 2003 15:06, Rouvas Stathis wrote:
There is another version of cron that is designed specifically for laptops that are not always on, just like this computer.
Unfortunately I can't remember the name, but a search on freashmeat might help.
Fcron? "Fcron is a periodical command scheduler which aims at replacing Vixie Cron, so it implements most of its functionalities. But fcron does not assume that your system is running neither all the time nor regularly : you can, for instance, tell fcron to execute tasks every x hours y minutes of system up time or to do a job only once in a specified interval of time. You can also set a nice value to a job, run it depending on the system load average and much more !" [Source: http://fcron.free.fr, 2003 February 17]
On Monday 17 February 2003 1:23 pm, Karol Pietrzak wrote:
On Monday 17 February 2003 15:06, Rouvas Stathis wrote:
There is another version of cron that is designed specifically for laptops that are not always on, just like this computer.
Unfortunately I can't remember the name, but a search on freashmeat might help.
Fcron?
"Fcron is a periodical command scheduler which aims at replacing Vixie Cron, so it implements most of its functionalities. [...]
Likewise there is "anacron", which has roughly the same description, and should be on your SuSE disks. OTOH, SuSE's current "cron.hourly/daily/weekly" methodology I think tries to work at an arbitrary time -- if you look closely at root's crontab, you see that every 15 minutes the "run-crons" task is fired; this task looks in the cron.<dirname> directories for tasks to execute, and only executes them if "/var/cron/lastrun" is missing or older than the time interval [I think it is /var/cron/lastrun -- check to be sure] Basically, I think you can put your backup script in "/etc/cron.daily", then either "at midnight" or "up to 15 minutes after you boot up", your daily backup will run. I suspect, however, running a backup 15 minutes into using the system will be, shall we say, "rather anoying?" -- Yet another Blog: http://osnut.homelinux.net
On Mon, 17 Feb 2003 19:32:57 GMT
John Pettigrew
In a previous message, Chris Geske wrote:
Why not leave the machines on all the time!
Because it's fairly noisy and is next to my bedroom!
Not everyone is interested in running an always-on linux box. Some of us just need a desktop machine for office hourse...
Just put a script in boot.local. Have it check the last time you backed up, and start a new one if needed. You could also put a script in halt.local if you needed, to make a timestamp of your last time online. -- use Perl; #powerful programmable prestidigitation
On Monday 17 February 2003 18:16, John Pettigrew wrote:
I have set up cron jobs to back up my system (thanks to those who recently posted links about this!). However, crontab entries are only (IIUC) executed when the values match the current time and date. Unfortunately, my box would thus go unbacked up if it wasn't turned on at the specified time.
Specifically, I have a script that moves the weekly system backups over to a monthly archive. This is set to run on the first of each month. However, if (for example) this was a weekend, the computer might not be on.
So, my question - is there a way to set things up so that a script will be run on a specific date or as soon after that as the computer is turned on? Even better, is it possible to set it up so that the script would run at a specified time (outside the working day) on the specified day or the first day thereafter (but at the specified time of day)?
You could set up a series of jobs, over say 3 days. If the first thing the script does is to check whether it's executed within the last 3 days (by checking file timestams, or a lock-type file) then only one will complete, the subsequent ones will die knowing they don't need to run. Dylan -- "Sweet moderation Heart of this nation Desert us not We are between the wars" Billy Bragg
participants (8)
-
Chris Geske
-
Dylan
-
Jerry Feldman
-
John Pettigrew
-
Karol Pietrzak
-
Rouvas Stathis
-
Tom Emerson
-
zentara