Mailinglist Archive: opensuse-edu (75 mails)
| < Previous | Next > |
Re: [suse-linux-uk-schools] Quick cron question...
- From: Andrew RAY <aray@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 29 Jul 2002 12:21:26 +0000 (UTC)
- Message-id: <20020729125736.B26083@xxxxxxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxxxxxxxx
********************************************************************************
> 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@xxxxxxxxxxxxxxxxxx
********************************************************************************
| < Previous | Next > |