* If the service is not enabled, it exits without starting the service.
* If the service is not enabled, it exits without starting the service.
{{Note box|msg=If a script exists in the <tt class="FILENAME">/etc/init.d/supervise/</tt> directory, <tt class="FILENAME">e-smith-service</tt> will use that in preference to the one in the <tt class="FILENAME">/etc/init.d/</tt> directory. This allows us to install our own supervised startup scripts <span class="emphasis">''without modifying the original package''</span>.}}
{{Note box|msg=If a script exists in the <tt class="FILENAME">/etc/init.d/supervise/</tt> directory, <tt class="FILENAME">e-smith-service</tt> will use that in preference to the one in the <tt class="FILENAME">/etc/init.d/</tt> directory. This allows us to install our own supervised startup scripts <span class="emphasis">''without modifying the original package''</span>.}}
+
+
===Adding a supervised service===
+
See http://thedjbway.org/daemontools.html
+
+
Check your application has a -d option or similar which means that it stays in the foreground, and logs to standard output rather than syslog. That makes it suitable for running as a supervised service.
+
+
Create a /var/service/XXX directory, containing an executable 'run' script something like:
+
+
#! /bin/sh
+
exec 2>&1
+
exec /var/service/XXX -d
+
+
and a /var/service/XXX/log directory, containing an executable 'run' script something like: