Configuring maintenance

In order to function correctly, OpenX runs an hourly maintenance script which performs the following tasks:

  • produces statistics from the previous hour
  • activates and deactivates campaigns
  • recalculates banner delivery priorities
  • sends out email-based reports

You can run the maintenance script in two ways:

  • built-in automatic maintenance
  • schedule an hourly task to run the maintenance script

OpenX will continue to run if the maintenance script is not executed. However, if the maintenance script does not run, campaigns with an expiry date or a fixed number of impressions will be delivered more often than desired. If you are having problems delivering these types of campaigns, check that the maintenance script is running correctly. When the maintenance script runs all outstanding raw data is processed.

Built-in automatic maintenance

The OpenX built-in automatic maintenance script has several advantages:

  • outstanding maintenance tasks are triggered by banner delivery
  • enabled by default on new installations
  • no need to create scheduled tasks

Automatic maintenance waits 5 minutes after the scheduled maintenance task was due to run, to ensure that any manually-scheduled maintenance has time to complete. With automatic maintenance you can:

  • enable and disable automatic maintenance on the Settings>Main Settings page.
  • view the current maintenance status on the Settings>Maintenance page.
  • view the log of maintenance runs on the Settings>User Log.

Scheduled maintenance

Scheduling maintenance as a task is more flexible than automatic maintenance. You can start the maintenance script by:

  • executing a locally run script
  • calling the script url on the web server

Scheduling tasks on Linux and Unix

On Linux, BSD, Solaris or MacOSX you can use the cron daemon to automatically run the maintenance script. In most cases you will need shell access to your server to add cron tasks. After logging on to your server, use the following command to export your existing scheduled tasks to a text file:
crontab -l > cron.txt
In a text editor, add one of the following entries to the cron.txt file:

When you have finished editing the cron.txt file, use the following command to import it into the cron daemon:
crontab cron.txt