Cron and Crontab commands
crontab - maintain crontab files for individual users.Similar to other commands this to have options .
-u It specifies the name of the user whose crontab is to be tweaked.
-l The current crontab will be displayed on standard output.
-r The current crontab will be be removed.
-e This option is used to edit the current crontab using the editor specified by the VISUAL or EDITOR environment variables.
Usage :
#crontab -u [user_name] - e
An entry under crontab for user specified by the user_name will be made and saved automatically on exiting the editor.
#crontab -u [user_name] - l
Shows the cron jobs for the user specified.
The cron jobs deceleration needs to be done in a 5 column format consisting of
- minute (0-59)
- hour (0-23)
- day of the month (1-31)
- month of the year (1-12)
- day of the week (0-6 with 0=Sunday)
#crontab -u jack - e
45 01 * * * /bin/echo "Hello Saurabh"
save and exit using ':wq' if using VI editor.
Viewing the cron job to edit
#crontab -u jack - l
Deleting the cronjob
#crontab -u jack - r