CronJob

CronJob

cron is the time based job schedular in unix like computer OS. cron enable users to schedule jobs ( command or script ). to
run periodically at certain time or dates. It is commanly used to automate system maintenance or administration.

===================================================================================
crontab file format

Min   Hours day   mounth      day_of_week command

min – 0-59
hours 0-23
day 1-31
month 1-12
day_of_week 0-6

===================================================================================

1> edit cron of particular user
#crontab -e -u username

2>list cron of particular user
#crontab -l -u username

3>remove cron of particular user
#crontab -r -u username

===================================================================================

Example
1> set cron run at 9:30AM every day

30 09 * * * /bin/echo “Hi’

2> set cron to run every 5 min

*/5 * * * * /bin/echo “Hi”

#service crond restart

====================================================================================

Checking cronjob logs
#tailf /var/log/cron

===================================================================================

Deny cron for particular user

#vim /etc/cron.deny
alex

:wq

====================================================================================

Posted in Fundamental

Leave a Reply