Web In A Box

Welcome, Guest Login

Support Center

Setup scheduled cron tasks

Last Updated: May 29, 2014 11:05AM AWST
You can setup cron tasks by using the crontab tool on our shell server via SSH, this guide will show you how it works.
  1. Use an SSH client to connect to shell.webinabox.net.au

    Windows: You can use the free SSH client PuTTY
    Linux, Mac: Open your terminal and run this command: ssh username@shell.webinabox.net.au
  2. Enter your username and password, which are the same as your web hosting FTP account
  3. Once logged in you should be presented with a prompt showing your domain username
    View your current crontab entries, if any, using the list command:
    testdomain.com@shell:~$ crontab -l
    no crontab for testdomain.com
    Open your crontab for editing using the edit command
    crontab -e
    The default editor is an easy to use text editor called Nano, the Ubuntu wiki has information on how to use it: https://help.ubuntu.com/community/Nano.  If you prefer to use a different editor, such as vim, you can prefix the crontab command with EDITOR=vim

    ‚ÄčIf you don't have any existing entries, the default file has a quick reminder of the file syntax at the top

    # m h  dom mon dow   command

    These columns define the time the job runs, and what command to run.  In order, they mean:

    minute (0-59)
    hour (0-23)
    day of the month (1-31)
    month (1-12)
    day of the week (0-7) (0 or 7 is Sun)

    For each column you can specify a single value, an asterisk ('*') to indicate all possible values, a range of numbers ('8-11') or a comma separated list including both ranges and single numbers ('1-5,7,9').

  4. Create a new scheduled task by creating a new line below any other existing lines, and specify time you want to run the job followed by the command.  Here's an example to run a php script at 6:00 AM every day.

    We denote the minute 0, the hour 6, and use an asterisk to match all possible days of the month, months and days of the week.

    0 6 * * * php $HOME/public_html/cron.php

    Here is another example which runs at 10:30PM Monday - Friday

    30 10 * * 1-5 php $HOME/public_html/cron.php

More information

  • https://help.ubuntu.com/community/CronHowto
  • https://help.ubuntu.com/community/Nano

Contact Us

  • Email Us
  • support@webinabox.net.au

    For business critical issues preventing you from completing work, you can call our on-call engineer
    P: 1800 850 370
    P: (08) 9481 0366
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found