Glam Prestige Journal

Bright entertainment trends with youth appeal.

Some of my installation scripts are using insserv, which was working fine for me on Ubuntu 16. Now on Ubuntu 18 the binary insserv is missing even though the package itself (albeit very trimmed) is there.

Is it a hard switch toward systemd init system? Strange that I couldn't find any announcement regarding unavailability of insserv on Ubuntu 18.

1

1 Answer

It is not too hard to use legacy init scripts with systemd. Here is an example. Given the following SysV init script in /etc/init.d/mylittledaemon:

#!/bin/bash
### BEGIN INIT INFO
# Provides: littledaemon
# Required-Start: $remote_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Description: My little daemon
### END INIT INFO
case "$1" in start) (sleep 5000) </dev/null >/dev/null 2>&1 & ;; stop) pkill -f "sleep 5000" ;;
esac

you can enable it using systemd like this:

$ sudo chmod +x /etc/init.d/mylittledaemon
$ sudo systemctl enable mylittledaemon
mylittledaemon.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable mylittledaemon

and then start it using

$ sudo systemctl start mylittledaemon

This will look at the LSB info comments and actually call update-rc.d, just like insserv did. It will also generate a transient systemd service unit using systemd-sysv-generator.

See also:

The better, long-term approach would be to convert your init scripts to systemd service units. There are plenty tutorials on the net, for example this one:

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy