11 Cron Scheduling Task Examples in Linux

Download Your Free eBooks NOW - 10 Free Linux eBooks for Administrators

Ravi Saive

Simple Word a Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux.

Your name can also be listed here. Work as a Paid freelancer/writer at TecMint.

Download Free Linux eBooks

Advanced Bash-Scripting Guide
Linux Bible
A Newbie's Getting Started Guide to Linux
Ubuntu Linux Toolbox: 1000+ Commands

You may also like...

11 Responses

  1. Steve says:

    One thing worth mentioning is that since cron runs in the background, its important to make sure you have some sort of logging or monitoring in place to make sure things are working as intended. Its all too easy to take things like this for granted, only to realize too late that something has been failing or perhaps not even running at all. https://www.cronalarm.com is a great service to help you keep tabs on all your cron jobs and scheduled tasks.

  2. Thilak says:

    Cron jobs meant for particular user fails to start automatically whenever the server undergoes reboot. what is the solution, to enable the cronjobs of that user to start automatically after the reboot?? help me…..
    Thanks in advance… :)

  3. Jay says:

    cant get this to run using command sudo crontab -e

    and i added this

    */5 * * * * php -f /var/www/html/cj/email1.php >/dev/null 2>&1

    but it only works when i goto page manually any ideas please anyone?

  4. hasani says:

    hello and good day
    I write script file that include tar command. when I write ./name file, then it works. but when write below command in crontab, it doesn’t work
    1 * * * * /home/dira/filename
    do you know why does it work?
    best regards

    • Ravi Saive says:

      @Hasani,
      The cron entry you’ve added was wrong, please user correct cron entry as shown.

      */1 * * * * /home/dira/filename
      
  5. Dar says:

    There is a good crontab GUI for finding out about the scheduling commands at http://www.cronsandbox.com

  6. Andre says:

    11. Disable Email Notification can also be done with MAILTO=””

  7. Sepehr says:

    Thanks for your great tutorial :)
    Really helped me.

  8. RSmith says:

    Akee, thats one way. Another way to have both commands run no matter what is to use “||” instead of “&&”

    @daily ( command1 || command2 )

    hth

  9. akee says:

    This line : “@daily && ” does not mean that command1 AND command2 will be run on a daily basis. It means that command1 will be run on a daily bases, and IF the return code of this command is 0 e.g a success, THEN command2 will be run after.

    You need to have two lines if you want both command to be run in any case :
    @daily
    @daily

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Join Over 62000+ Linux Users
  1. 46679
  2. 2055
  3. 10101

Enter your email to get latest Linux Howto's