Chapter 21. Scheduled tasks

Table of Contents

21.1. Testing the crontab
21.2. System scheduled tasks

Jobs can be scheduled to run on a per-domain basis. This is configured in the same style as the traditional crontab, and is kept in the config/ directory of a domain. Configuration of the per-domain crontab is covered in Chapter 9, Scheduled tasks.

21.1. Testing the crontab

The crontab can also be tested. To do this you have to SSH to the machine, usually as admin to run the command.

For example, to test the my-brilliant-site.com crontab navigate to /srv/my-brilliant-site.com/config/ and run symbiosis-crontab --test crontab.

The my-brilliant-site.com crontab reads

# Send any output to Bob
#
MAILTO=bob@my-brilliant-site.com

#
# run at 18:40 every day
#
40 18 * * *       echo Hello Dave.

#
# run at 9am every Monday - Friday
#
0 9 * * mon-fri wget http://www.my-brilliant-site.com/cron.php

#
# Run once a month
#
@monthly          /usr/local/bin/monthly-job.sh

Therefore the output generated is

 Environment
 ------------------------------------------------------------------------
 HOME = /srv
 LOGNAME = admin
 PATH = /usr/local/bin:/usr/bin:/bin
 MAILTO = bob@my-brilliant-site.com
 ========================================================================

 Jobs next due -- Local time 2010-06-17T17:57:37+01:00
 ------------------------------------------------------------------------
 Date                       Command
 ------------------------------------------------------------------------
 2010-06-17T18:40:00+01:00  echo Hello Dave.
 2010-06-18T09:00:00+01:00  wget http://www.my-brilliant-site.com/cron.php
 2010-07-01T00:00:00+01:00  /usr/local/bin/monthly-job.sh
 ========================================================================

Note

The only environment variables that can be set within your crontab are PATH and MAILTO. All the rest are set automatically, and cannot be altered.

21.2. System scheduled tasks

There are various automated tasks which are executed upon a Symbiosis system. These scheduled tasks are responsible for automating things such as:

  • The addition of new IP addresses to your system.
  • The generation and upload of DNS data.

The following section document precisely which jobs are installed by default, along with their purpose.

These are the system tasks which are installed by default:

/etc/cron.d/symbiosis-common
This carries the rudimentary password checks on mail and FTP passwords on an hourly and weekly basis.
/etc/cron.d/symbiosis-cron
This is responsible for launching any user-scheduled jobs, as described in Chapter 21, Scheduled tasks, and is run every minute.
/etc/cron.d/symbiosis-firewall
The jobs here are responsible for checking for new blacklist and whitelist entries, as discussed in Section 19.6, “Blocking abusive remote hosts”. The whitelist and blacklists are regenerated every 15 minutes. The whole firewall is reloaded hourly.
/etc/cron.d/symbiosis-monit
This schedules the Symbiosis service monitor, which is described in Chapter 24, Service Monitoring. This is run every two minutes.
/etc/cron.d/symbiosis-dns
This regenerates DNS data for all the domains in /srv/, and triggers an upload to the Bytemark DNS server.
/etc/cron.d/symbiosis-updater
This script is responsible for fetching and applying pending package updates. It is run on a daily basis.
/etc/cron.daily/symbiosis-httpd-rotate-logs
This manages rotation of the webserver log files for each domain.
/etc/cron.hourly/symbiosis-configure-ips
This adds IP addresses configured by domains in config/ip to the host, as described in Chapter 13, Configuring SSL Hosting
/etc/cron.hourly/symbiosis-httpd-configure
This task creates a per-IP Apache configuration file for new IP addresses, and is closely related to the previous task.