SystemD SysV generator and mounts

systemd

So systemd-sysv-generator converts old style init.d files into systemd service files. But it might do this before all mounts have been mounted.

I have some legacy commercial software that lives in /opt which is a separate mount point. It creates a symlink from /etc/init.d/their_service to a file in /opt

So when the server boots, systemd-sysv-generator cant yet read the linked file and fails to create a service and thus fails to start the service.

As the legacy software is managed by another team and they have the power to update it themselves, I don't want to start copying the file out of /opt and replacing the symlink. Or worse, try rewriting this into a systemd service myself.

Is there any way to have systemd-sysv-generator fire after opt.mount?

Best Answer

One option might be to create a drop-in for their service, that specifies dependencies/order.

For example:

$ sudo mkdir /etc/systemd/system/their_service.service.d
$ sudo vi /etc/systemd/system/their_service.service.d/50-require_mounts.conf
[Unit]
Wants=network.target remote-fs.target
After=network.target remote-fs.target

However, the SysV script could be adapted to sort this problem (https://www.freedesktop.org/software/systemd/man/systemd.special.html):

remote-fs.target Similar to local-fs.target, but for remote mount points.

systemd automatically adds dependencies of type After= for this target unit to all SysV init script service units with an LSB header referring to the "$remote_fs" facility.