4 ProjectDaemons
David Anderson edited this page 2023-08-10 04:00:18 -07:00

Daemons

Daemons are server programs that normally run continuously. Your project's daemons are described in its config.xml file, with elements of the form:

<daemon>
  <cmd> feeder -d 3 </cmd>
  [ <host>host.domain.name</host> ]
  [ <disabled> 0|1 </disabled> ]
  [ <silent_start> 0|1 </silent_start> ]
  [ <output>filename</output> ]
  [ <pid_file>filename</pid_file> ]
</daemon>
<daemon>
...
</daemon>

cmd

The command used to start the daemon. Must be a program in the project's bin/ directory.

host

Specifies the host on which the daemon should run. The default is the project's main host, as specified in config.xml.

disabled

If set to 1, ignore this daemon. Note: <disabled/> won't work; you must specify a number.

silent_start

If set to 1, don't print a message at project startup about this daemon. Note: <silent_start/> won't work; you must specify a number.

output

Name of output file (in the log_HOSTNAME directory). Defaults to the program name followed by '.log'. If you're running multiple instances of a daemon on one host, you must specify this.

pid_file

Name of file used to store the process ID (in the pid_HOSTNAME directory). Defaults to the program name followed by '.pid'. If you're running multiple instances of a daemon on one host, you must specify this.

Daemons are executed in a directory tmp_hostname/ (not bin/). Daemons are started when you run the bin/start script, and killed (by a SIGHUP signal) when you run bin/stop.

Typically, this mechanism is used to run work handling daemons. Projects that use trickle-up messages will also need to have a trickle-up handler.