Wednesday, March 4, 2015

Dealing with Crontab

Schedule tasks under Linux is an powerful procedure which is used by almost everyone, and to do this using program called cron. more about it here .


Procedure :

make a new text file, and enter this line in that text file like the below :-

crontab myfirstjob

Formatting crontab file :-

what this file contains

Number
Meaning
Allowed range
1
Minutes
0-59
2
Hours
0-23
3
Days
1-31
4
Months
1-12 OR First 3 letters of the Month name
5
Days of the week
0-7 OR First 3 letters of the Day name
6
Name of the program
Any program


Some useful command can be used with cron :-

Show all the task running under cron.

crontab -l
edit the crontab
crontab -e


Some example from crontab file :-

# Minute   Hour      Day of Month       Month                 Day of Week        Command  
# (0-59)     (0-23)     (1-31)             (1-12 or Jan-Dec)    (0-6 or Sun-Sat)              
    0               12           *                             *                         *            /u01/backup.sh

For more example about crontab press here

Cheers
Osama Mustafa

No comments:

Post a Comment