Officeshots Background Daemon

The central Officeshots server comes with a background daemon that does most of the heavy lifting. This daemon is responsible for processing uploaded files, generating page caches and many other tasks. The installation of this dameon is covered in the Servern Installation Guide. The Officeshots server will not function properly when this daemon is not running.

Daemon tasks

The background daemon is responsible for the following tasks:

  • Scanning all uploaded files with ClamAV
  • Running all ODF validators on uploaded ODF files
  • Generating page caches for the ODF testsuite galleries
  • Expiring old requests
  • Creating jobs for new applications that participate in the ODF testsuite renderings

The background daemon is not responsible for:

  • Anonymising uploaded ODF documents. This happens immediately on upload by the main server
  • Adding new documents to the ODF testsuites. This is done manually.

Running the daemon

The background daemon uses Beanstalkd as a message queue to communicate with the outside world. Before you start the daemon, you should make sure that Beanstalkd is properly installed, configured and running.


You can start the daemon with the following command. This command must be run from the www/app directory in Officehots:

../cake/console/cake worker run

You must run the background daemon with the same privileges as the webserver. Both process need to read and write to the same files. For Debian sustems this means that the daemon must run as user www-data

If you want to run the daemon from a different location then you must pass the -app argument, with the full path to www/app. For example:

path/to/cake/console/cake -app /var/www/ worker run

Beanstalkd (and Officehots) can use differently named workqueues. This makes it possible to run multiple Officehots instances on the same server using one Beanstalkd daemon. A workqueue in Beanstalkd is called a tube. The default tube name that Officeshots uses is configured in the core configuration. If you want to override which tubes the background daemon listens to, you can add the tube names after the tubes parameter:

../cake/console/cake worker run -tubes <tubename>

By default, the background daemon works as a regular Unix daemon, forking to the background when it starts. If you want to run it in the foreground (e.g. for debugging purposes) then add the nofork option:

../cake/console/cake worker run -nofork


To stop the daemon, use the stop command:

../cake/console/cake worker stop

Note that there may be a delay between issuing this command and the daemon actually stopping. When you issue the stop command, a high priority message is delivered to the daemon through Beanstalkd. But if the background daemon is very busy at the moment (e.g. validating a file or regenerating a page cache) then it may take some time before the daemon actually checks the message queue and recieves the stop command.

Status information

By issuing the status command, you can see if the daemon is currently running. If it is running, the status message will tell you what it's process ID is, what tubes it is listening to and some statistics on the Beanstalkd queue.

../cake/console/cake worker status

Automatically starting the daemon on boot

Officeshots comes with an init file that you can use to automatically start and stop the daemon when your server boots. You can find this file in the contrib directory. Copy the file contrib/officeshots to the directory /etc/init.d and configure your runlevels appropriately:

# update-rc.d officeshots defaults

Now you can use your usual init commands to control the background daemon. E.g:

# /etc/init.d/officeshots start
# /etc/init.d/officeshots stop
# /etc/init.d/officeshots restart

Troubleshooting and debugging

By default the Officeshots daemon logs to the CakePHP logfiles. You can find these in www/app/tmp/logs/error.log. If you have enabled debug logging in CakePHP then it will also log to www/app/tmp/logs/debug.log. On occasion it may also be useful to run the daemon inside a screen session using the -nofork option. When run in the foreground the daemon will log debug information to the standard output.

Last modified 10 years ago Last modified on 05/31/10 16:46:42