[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: systemd .service file conversion



On Sun, May 26, 2013 at 10:29:25PM +0200, Helmut Grohne wrote:
> I find it depressing to see four init/rc systems, of which three are
> mutually incompatible in every single possible aspect.

At the risk of adding another level of indirection, we could add a
meta-init format that can generate an appropriate file for any of these.

> Dependency annotation:
>  * sysv: LSB headers
>  * openrc: a shell function
>  * systemd: ini-file / not needed due to socket activation
>  * upstart: another syntax

This should be fairly easy to generate from a meta-init format.

> Socket activation:
>  * sysv: inetd can pass one accepting socket as stdin
>  * openrc: no clue
>  * systemd: sockets passed as fd 3 and higher + environment variables
>    LISTEN_FDS and LISTEN_PID
>  * upstart: socket passed as fd specified in environment variable
>    UPSTART_FDS

If the services support socket activation, a sysvinit script could
probably pass the FDs using an environment variable and some shell
redirection.  Alternately a small C wrapper could be used, or this could
be pushed into start-stop-daemon.

> Daemon startup signalling:
>  * sysv: shell script flexibility^Whell
>  * openrc: no clue, guess like sysv
>  * systemd: signalling via dbus, systemd-specific notification mechanism
>    or just assume it to be ready
>  * upstart: tracking via ptrace, tell number of expected forks ahead

This would be harder to abstract.

> Resource limits:
>  * sysv: shell has ulimit
>  * openrc: I guess like sysv
>  * systemd: declarative, ini-file
>  * upstart: declarative syntax

We can generate ulimit commands for sysv and openrc and appropriate
entries in the systemd and upstart files.

> How is anyone supposed to write a service that runs with all of them?
> 
> Disabling service:
>  * sysv: /etc/default/$service is frowned upon, update-rc.d $service
>    disable (or chkconfig if you are on redhat)
>  * openrc: rc-update something
>  * systemd: "three levels of off", systemctl disable $service.service,
>    but this gets more complex with lsb init script compatibility
>  * upstart: echo manual > /etc/init/$service.override

We already have update-rc.d, so we can make it DTRT depending on the
actual init system in use.

> Given the above I do not believe supporting even two of the above in a
> native way (i.e. without lsb compatibility) is possible for a
> distribution like Debian. Is there any chance in pushing upstreams to
> consolidate interfaces in any way to make this easier?

A meta-init format would make everyone equally happy (or miserable,
depending on your point of view), which may be the best way to solve the
problem.  I fear that consolidation of interfaces is unlikely to occur.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187

Attachment: signature.asc
Description: Digital signature


Reply to: