====== Regular Server Maintenance ======

Some tasks have to be run on the survey server regularly: archiving old projects, deleting temporary files, deleting obsolete user accounts (inactive members) and optimization of database tables.

A maintenance script ''/admin/cronjob.php'' performs these tasks. This script is password-protected, which you can set in **Server Settings** under **Configuration**. This password is passed to the script as the parameter ''password''. 


===== Automatic Maintenance =====

It makes sense to run maintenance daily. The PHP interpreter is called up in order to do so -- the PHP file (with a complete path), and the password as the second parameter is passed to this.

You can copy the PHP script's complete path directly in **Server Settings** -> **Configuration** -> //Server// tab -> //Script for Sever Maintenance//.

Setting this to run automatically in Windows and Linux is described in the [[:en:server:crontask]] chapter. In Linux, the ''crontab'' entry for this to be run daily at 4.30 could look as follows:

<code>
30  4  *  *  *  /usr/lib/cgi-bin/php /var/www/html/sosci/admin/cronjob.php password=SECRET
</code>


===== Manual Maintenance =====

Server maintenance can also be carried out manually.

  * Log into SoSci Survey as an administrator and select **Server Management** -> **Server Maintenance** -> **Now Perform Cronjob**
  * Alternatively, call up the URL directly in the browser: **%%http://www.domain.tld/sosci/admin/cronjob.php?password=SECRET%%**


===== Cronjob Return Values =====

The cronjob returns the following messages:

  * ''ok'' -- Cronjob complete: everything is working correctly
  * ''warning'' -- Cronjob complete: there were warnings
  * ''error'' -- Cronjob complete: there were errors
  * ''denied'' -- Password is incorrect (if provided)
  * ''delayed'' -- Cronjob was performed within the last 6 hours and does not have to be carried out again at this moment in time

The server administrator will receive an email with further details regarding the cronjob, which also lists uploaded files, new user accounts and projects. Some pieces of information from the cronjob (e.g. deleted users and projects) will also be noted in the cronjob log file. 
