go to  ForumEasy.com   
JavaPro
Home » Archive » Message


[Email To Friend][View in Live Context][prev topic « prev post | next post » next topic]
  Crontab format
 
Subject: Crontab format
Author: Linux
In response to: crontab -- schedule tasks on Linux
Posted on: 09/03/2012 05:27:01 PM

Cronjobs are expressed in two formats: in number or in keyword.

Numberical format

* * * * * /bin/execute/this_script.sh


As you can see there are 5 stars. The stars represent different date parts in the following order:
  • 1st * -- minute (from 0 to 59)
  • 2nd * -- hour (from 0 to 23)
  • 3rd * -- day of month (from 1 to 31)
  • 4th * -- month (from 1 to 12)
  • 5th * -- day of week (from 0 to 6) (0=Sunday)

    Note: If you leave the star, or asterisk, it means every. By default, ***** means that the task is being executed every minute.

    Keyword format

    @<keyword> /bin/execute/this_script.sh
    


    Here are some useful keywords instead of a number:
    @reboot     Run once, at startup
    @yearly     Run once  a year     "0 0 1 1 *"
    @annually   (same as  @yearly)
    @monthly    Run once  a month    "0 0 1 * *"
    @weekly     Run once  a week     "0 0 * * 0"
    @daily      Run once  a day      "0 0 * * *"
    @midnight   (same as  @daily)
    @hourly     Run once  an hour    "0 * * * *
    



     

    > On 09/03/2012 05:10:11 PM Linux wrote:

    If you want some maintenance tasks (creating backups, synchronizing caches, and scheduling update on statistics) to be automatically run in the background at regular intervals, you can achieve it on Linux by crontab.

    The crontab (cron derives from chronos, Greek for time; tab stands for table) command, found in Unix and Unix-like operating systems, is used to schedule commands to be executed periodically. To see what crontabs are currently running on your system, you can open a terminal and run:
    $ sudo crontab -l
    

    To edit the list of cronjobs you can run:
    $ sudo crontab -e
    





    References:

  •  


     
    Powered by ForumEasy © 2002-2022, All Rights Reserved. | Privacy Policy | Terms of Use
     
    Get your own forum today. It's easy and free.