On 07/04/2014 14:41, Ansgar Burchardt wrote:
> Something like
> 
> +---
> | [Unit]
> | Description=daemontools service supervision
> | Documentation=man:svscanboot(8)
> |
> | [Service]
> | ExecStart=/usr/bin/svscanboot
> | Restart=always
> |
> | [Install]
> | WantedBy=multi-user.target
> +---
> 
> might already be enough as a .service file for daemontools.

This works, but there might be optional changes that provide a bit more
integration into systemd:

+---
| [Unit]
| Description=daemontools service supervision
| Documentation=man:svscan(8)
|
| [Service]
| ExecStart=/usr/bin/svscan /etc/service
| StandardOutput=journal
| StandardError=inherit
| Restart=always
|
| [Install]
| WantedBy=multi-user.target
+---

With this .service file, there is no longer a

  svscan ... | readproctitle ...

pipe, but the error messages are instead logged to the journal. They are
easily accessible when checking the state of daemontools via systemctl:

-----------------------------------------------------------------------
# systemctl status daemontools
daemontools.service - daemontools service supervision
   Loaded: loaded (/etc/systemd/system/daemontools.service; disabled)
   Active: active (running) since Fri 2014-07-04 14:53:52 CEST; 59s ago
     Docs: man:svscan(8)
 Main PID: 16870 (svscan)
   CGroup: /system.slice/daemontools.service
           ├─16870 /usr/bin/svscan /etc/service
           ├─16871 supervise sleep
           ├─16942 /bin/bash ./run
           └─16943 sleep 60

Jul 04 14:54:36 snout svscan[16870]: supervise: fatal: unable to start
sleep/run: access denied
Jul 04 14:54:37 snout svscan[16870]: supervise: fatal: unable to start
sleep/run: access denied
Jul 04 14:54:38 snout svscan[16870]: supervise: fatal: unable to start
sleep/run: access denied
Jul 04 14:54:39 snout svscan[16870]: supervise: fatal: unable to start
sleep/run: access denied
Jul 04 14:54:40 snout svscan[16870]: supervise: fatal: unable to start
sleep/run: access denied
Jul 04 14:54:41 snout svscan[16870]: supervise: fatal: unable to start
sleep/run: access denied
Jul 04 14:54:42 snout svscan[16870]: supervise: fatal: unable to start
sleep/run: access denied
Jul 04 14:54:43 snout svscan[16870]: supervise: fatal: unable to start
sleep/run: access denied
Jul 04 14:54:44 snout svscan[16870]: supervise: fatal: unable to start
sleep/run: access denied
Jul 04 14:54:45 snout svscan[16870]: supervise: fatal: unable to start
sleep/run: access denied
-----------------------------------------------------------------------

Killing svscan restarts the service as expected:

-----------------------------------------------------------------------
# kill 16870
# systemctl status daemontools
daemontools.service - daemontools service supervision
   Loaded: loaded (/etc/systemd/system/daemontools.service; disabled)
   Active: active (running) since Fri 2014-07-04 14:55:02 CEST; 2s ago
     Docs: man:svscan(8)
 Main PID: 16950 (svscan)
   CGroup: /system.slice/daemontools.service
           ├─16950 /usr/bin/svscan /etc/service
           ├─16951 supervise sleep
           ├─16952 /bin/bash ./run
           └─16953 sleep 60

Jul 04 14:55:02 snout systemd[1]: Starting daemontools service
supervision...
Jul 04 14:55:02 snout systemd[1]: Started daemontools service supervision.
-----------------------------------------------------------------------

As far as I know, this still misses the maintainer script logic that is
needed to start the service on installation and stop it again when the
package is removed.

There is a debhelper addon to add them, but the daemontools doesn't use
debhelper so they have to be added manually. The snippets can be found
in autoscripts/* in the init-system-helpers source package (it also
needs a runtime dependency on init-system-helpers).

Ansgar


-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to