CronTab Basics
Commands
__________
export EDITOR=vi ;to specify a editor to open crontab file.
crontab -e Edit your crontab file, or create one if it doesn't already exist.
crontab -l Display your crontab file.
crontab -r Remove your crontab file.
crontab -v Display the last time you edited your crontab file. (This option is only available on a few systems.)
Crontab file
___________
syntax :-
A crontab file has five fields for specifying day , date and time followed by the command to be run at that interval.
* * * * * command to be executed
- - - - -
| | | | |
| | | | +----- day of week (1 - 7) (monday = 1)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
* Indicates all possible values as in braces for that column.
Here is an Example
_______
A line in crontab file like below removes the tmp files from /home/user/tmp each day at 6:30 PM.
30 18 * * * rm /home/user/tmp/*
| | | | |
| | | | +-----------------------day of week (1 - 7) (Monday = 1)
| | | +-------------------------month (1 - 12)
| | +----------------------------day of month (1 - 31)
| +-------------------------------hour (0 - 23)
+---------------------------------- min (0 - 59)
No comments:
Post a Comment