Re: [suse-linux-uk-schools] Quick cron question...
crontab -e
A neater way to keep a history of the old crontab entries (just in case your changes cause things to go wrong): 1. As the user whose crontab you are changing (presumably root in your case), make a suitable directory (~/cronfiles). 2. In that directory, execute crontab -l > original.root.cron crontab -l > 2002.07.29.root.cron (This places the contents of the current crontab in a text file you can edit with vi, and preserves an original.) 3. vi 2002.07.29.root.cron (This allows you to edit the copy of the cron file that you will update.) 4. crontab 2002.07.29.root.cron (This reads your edited file, replacing the current cron settings with your proposed new ones.) By these small extra steps, you can keep various versions of the cron file available for immediate use, and obviously re-name them if you find it helps. More ...
The entry you want to do if you want to run something every 15 mins is
0-59/4 * * * * root /path/to/my/script
Sorry, but it is not. The columns normally work out like this: #mins hours Day-of-month Month Day-of-week (User-name-if-this-is-the-system-cron) Command 0-59/15 * * * * root /path/to/my/script is the correct entry. The figure after the / indicates the *step to jump* in units appropriate to the cron entry you are looking at (here, minutes), and is not used as a divisor in the sense Gary suggested. The man page Gary Stainburn referred you to is really very clear, so follow his advice and make sure you understand it. Hope this helps Andrew -- ******************************************************************************** E-Mail: aray@computerpark.co.uk ********************************************************************************
On Mon, 29 Jul 2002, Andrew RAY wrote: > > crontab -e > A neater way to keep a history of the old crontab entries (just in case > your changes cause things to go wrong): > 1. As the user whose crontab you are changing (presumably root in > your case), make a suitable directory (~/cronfiles). > 2. In that directory, execute > crontab -l > original.root.cron > crontab -l > 2002.07.29.root.cron > (This places the contents of the current crontab in a text file you can > edit with vi, and preserves an original.) > 3. vi 2002.07.29.root.cron > (This allows you to edit the copy of the cron file that you will update.) > 4. crontab 2002.07.29.root.cron > (This reads your edited file, replacing the current cron settings with your > proposed new ones.) > By these small extra steps, you can keep various versions of the cron file > available for immediate use, and obviously re-name them if you find it > helps. Even nicer: While in your home directory (or anywhere else you don't mind storing your crontab file) : crontab -l > crontab ci -l crontab You can do this as many times as you like: the "ci" command is part of RCS and will store all the different versions of your crontab into a crontab,v file. It will only store the differences between subsequent versions, which is space-efficient. If you want to go one step up, you can use CVS instead of plain old RCS. It's fun to be able to type commands like: cvs diff -D "last Thursday" crontab which will show you all the changes you have made since last Thursday, or cvs update -j1.4 -j1.2 crontab which will undo any changes you made from version 1.2 to version 1.4 of your crontab (even if you are currently on version 1.7!). Michael Brown http://www.fensystems.co.uk -- Fen Systems: Linux made easy for schools
participants (2)
-
Andrew RAY
-
Michael Brown