Linux Server and Workstation Configuration How To

  • Decrease font size
  • Default font size
  • Increase font size
  • default color
  • red color
  • green color
Home Manual Linux, UNIX Cron Manual
Cron Manual PDF Print E-mail
Thursday, 03 December 2009 12:43
AddThis Social Bookmark Button

Files

  • “username” user’s cron file location

    /var/spool/cron/{username}
  • Root's crontab file

    /var/spool/cron/root
  • Configuration file for cron,

    /etc/crontab

Cron service

# service crontd status
# service crontd start
# service crontd stop
# service crontd restart

Valid values for cron job

  • Minutes - from 0 to 59
  • Hours - from 0 to 23
  • Day of month - from 1 to 31
  • Month - from 1 to 12 (also from jan to dec)
  • Day of week - from 0 to 6 (0 is sunday, also from sun to sat)

Cron monitoring commands

  • Check cron config

    # chkconfig --list | grep crond
    # ps -ef | grep cron
  • Show current cron jobs of user

    # crontab -l
  • Show current cron jobs of user root

    # crontab -u root -l
  • Delete cur cron jobs

    # crontab -r
  • Delete user's cur cron jobs

    # crontab -u root -r
  • Edit the cron tab jobs

    # crontab -e
  • Edit the user's cron tab jobs

    # crontab -u root -e
  • Install cron job for user root from file /var/spool/cron/root content

    # crontab -i -u root /var/spool/cron/root

Example of cron file

# Cron example file /var/spool/cron/root
# (Created for Boot1935)
SHELL=/bin/bash
MAILTO=root

# 1-12 hours
* 0,1,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 * * * /root/reich3/saytime.sh
# minutes with 5 minute interval
5,10,15,20,25,30,35,40,45,50,55 * * * * /root/reich3/saytime.sh
# hours 0-1, 9-23
* 0-2,9-23 * * * play /root/reich3/saytime.wav
# every minute
0-59 * * * * /root/reich3/saytime.sh
 

Add comment


Security code
Refresh

Useful Links

Follow us on ...

  • Digg: hgevs
  • Facebook Page: 180986722511
  • Linked In Group: 2571120
  • Ning: linuxconfignet
  • Twitter: linuxconfignet

Friends

Thanks David Ayvazyan for provided useful information and discussions.
www.gnu.am (Armenian Translation)