if you are interested to contribute your LAB PROGRAM Please send mail to jkumaron@gmail.com

Difference Between Cron Job And at command | How To Backup The cron Job

cron job is used to schedule the job. It is used for maintain the daily routing work.
Where is cron job file is located
File located in the every user Home directory file name “.crontab” or /etc/crontab
crontab it is refers to the cron table

Minutes:Hours:Day:Month:Day of the Week
15 * * * 2,4,6 myscript
it will run the script Tuesday Thursday and Saturday
Crontab Different Option
crontab –e Edit the cron tab file for the current user
crontab -l List the cron job
crontab -r remvoe the cron job

Crontab Example
1 0 * * * echo -n "" > /var/log/dmesg
These command run every day and clear the log file

How To Backup The Crontab File
crontab -l >backup_cronjob_10-2-2010
crontab -l > /path/to/your/backup/file

Ever day Backup
Run Ten Minutes after midnight, every day
:10 0 * * * /var/backup.sh
Monthly Backup
Run at 5:30pm on the second of every month
:30 17 2 * * /var/monthbackup.sh
Weekly Backup
Run at 11pm on weekdays
: 0 23 * * 1-5 /var/weekdays.sh

Linux at command

At schedule the task at only once

[root@bash ~]#at 8:20pm
at> init 6
job 2 at 2010-08-05 20:20
Can't open /var/run/atd.pid to signal atd. No atd running?
Run the at command At specified Time and Day
[root@bash ~]#at 10am sunday
at> echo "welcome"

At Command Specified Date and Time
[root@bash ~]#at 6am Aug 20
at> echo "$Joshi Mariiage wedding Day"
Atq it will display list of the queue in the at command
[root@bash ~]#atq
1 2010-08-05 20:00 a root
3 2010-08-08 10:00 a root
2 2010-08-05 20:20 a root
Where confab file is is located

Related post