29 Jul
2002
29 Jul
'02
22:02
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