Sunday, September 11, 2011

Linux command "Cron" and running crontab jobs


The crontab command is used to manage cron jobs. The -l option displays the current list of jobs for the user.
admin@suresh$ crontab -l
This show the current running cron jobs
crontab -l : Display the information for scheduled jobs
crontab -e : Edit the user’s list of scheduled jobs
crontab -r : Remove the definition of scheduled jobs
crontab filename : Replace the current crontab file
If you want to edit a cron
admin@suresh$ crontab -e
* * * * * command to be executed
- – – – -
| | | | |
| | | | +—– day of week (0 – 6) (Sunday=0)
| | | +——- month (1 – 12)
| | +——— day of month (1 – 31)
| +———– hour (0 – 23)
+————- min (0 – 59)
cron example :
*/30 * * * * date > ~/out.txt
here for every 30mins its send the date output to out.txt file