How to use Crontab Command

Crontab:It is used to Schedule jobs.
Crontab –l: -l is used to List out the job for current user.
Crontab –e:-e is used to edit schedule jobs for current user. 
Crontab –r:-r is used to remove all job for current user.
Note : Don't try this command until unless remove jobs.
Crontab –e –u <Username> : It is used to edit jobs for particular user. 







Cat /etc/crontab : It used to check cron job info.

*/1 * * *  * /root/cpu.sh 

*      * * * *
Minute     Hour Day  Month Day of week  

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  . ------- month (1 - 12) OR Jan, feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR 
# |  |  |  |  |
# *  *  *  *  * 
Be practice below examples which are very useful in real time environment.

*/1 – Every one minute 
*/1-   Every one hour
1-31 Day of the month
1-12(Jan to Dec)
0-6(Sunday to Monday) 0Sunday, 1Monday, 2Thesday

Every day 7-18
* 7-18 * * *  /root/cpu.sh 
Every month 15,16 dates
* * 15,16 * *  /root/cpu.sh 
6 Month one time only
* * * 6 *  /root/cpu.sh 
Every Tues day
* * * * 2  /root/cpu.sh 


Comments

Popular posts from this blog

Awk command with simple examples

Learn Linux in Telugu | Linux complete Free Course in Telugu by 7Hills

rsync Command Examples | rsync Command In Telugu