Skrevet av Emne: How to schedule tasks using the system crontab (Vixie crond)  (Lest 2686 ganger)

ATC

  • Gjest
How to schedule tasks using the system crontab (Vixie crond)
« på: 27. ſeptember 2008, 18:24 pm »
  • [applaud]0
  • [smite]0
  • This article describes how to set up schedules tasks using the system crontab under most Linux systems. It may not apply to all versions of Linux or crond.



    ATC

    • Gjest
    [Solved] How to schedule tasks using the system crontab (Vixie crond)
    « Svar #1 på: 27. ſeptember 2008, 18:24 pm »
  • [applaud]0
  • [smite]0
  • 1. Edit the "/etc/crontab" file
    2. Run "/etc/rc.d/init.d/crond restart" to activate changes

    The format of the system crontab file is as follows:
    1 = Minutes
    2 = Hour
    3 = Day
    4 = Month (0= names are OK)
    5 = Weekday (0=Sun, 1=Mon etc, names are OK)
    6 = Owner
    7 = Command
    A field may be an asterisk (*), which always stands for first-last''.
    A field may me a range, for example 1-4
    A field may specify more than one value, using comma without spaces
    A field may specify intervals using slash, for example 1-6/2

    Examples:
    # Nightly backup executed at 5:00am
    00 5 * * * root /root/backup/data
    # Replicate web server every 30 minutes
    00,30 * * * * root /home/httpd/html/replicate quiet

    Any error messages or other output from the binaries or scripts executed will be automatically emailed to the job owner. For more information about the system crontab file, see "man 5 crontab".