Skip to content

Cron Jobs

Take routine maintenance or other repetitive tasks off your plate by automating them as cron jobs. Cron jobs run on a schedule that you set with one command. You use SSH access to set jobs on a per container basis.

How to Schedule and Manage Cron Jobs

To begin, you’ll need to have an SSH/SFTP user linked to the container that you want to work with. Once that’s done, the process is very straightforward.

  1. SSH into the relevant container.
  2. Change into the containers/crontabs/ directory. You can use this command: nano /container/crontabs/crontab
  3. Edit the crontab file to add or change jobs. Note that the operating system timezone is UTC (0).
  4. Leave an empty line at the end of the file.
  5. Save the file.

You might need to wait a minute or so for the file to be processed.

Cron Job Format

Each line of your crontab file represents a job. The first five fields define the timing or scheduling rules, followed by the shell command to be executed.

If you’re new to this, or need a refresher, Wikipedia’s cron article is a good place to start. Another handy resource, Crontab Guru, lets you quickly check that your scheduling will work the way you want it to.

User www-data

Cron jobs are executed as the user www-data (uid: 33). This user should have access to all files and directories within the /container directory, except the /container/backup/containers directory.


When cron jobs aren’t working properly, there are a few quick checks that can help.

Three things to double-check in the crontab file itself:

  • Ensure your crontab file is in the UNIX text file format. This is especially important for Windows users. We would recommend editing the crontab file via SSH using nano or vim text editors.
  • Make sure that you have an empty new line at the end of the file.
  • Add a MAILTO variable to the first line. When tasks are processed, you’ll be emailed the outputs of the commands that have been run. If there’s no output, there will be no email.

Or, elsewhere:

  • SSH into the container and run the task manually through the command line. This lets you see whether the job is working like it should.
  • Check the /container/logs/rsyslog/syslog log file. If your crontab file is being processed, you will see: CRON[XX]: (root) CMD (/bin/cat /cron/crontab | /usr/bin/crontab -u www-data -)

Mapping From Your SSH Connection to the Container

To make Webslice Containers as generic as possible, we made some choices that mean the mapping of the directory differs from what you can see in your SSH session.

If you want to execute files under the /application directory, or to write to a log file, consider using /container/ instead of the paths you can see when connected via SSH.

Path to use (SSH)Equivalent path