Remix.run Logo
egorfine 3 days ago

Until you need to actually dive deep into complicated scenarios. In sysv init you were on your own, which could be for better or for worse. In the world of systemd you either do as LP says or you do not at all.

I vastly prefer #1.

ndsipa_pomu a day ago | parent [-]

Why can't you just call a sysv init script (or other customised script) from a systemd service? I did this just the other day when I wanted to delay starting of docker/nfs-kernel-server until a DRBD disk was mounted. I found problems with doing it just using the standard systemd methods to delay start as having a prerequisite meant that the service would fail to start and not attempt to restart. My solution was to put together a script that would check for the existence of a file (located on the mounted DRBD disk) and sleep for 5 seconds if it didn't exist and as soon as the file did exist, it'd call the systemctl command to start docker etc.

Systemd gives you both worlds.

egorfine 4 hours ago | parent [-]

Personally I would just throw a script for this service as you have described.

Commercially I would do my best to implement this using systemd features, then finally give up and throw a script but with extensive comments describing reasons why it has to be a script instead of a systemd unit file.

ndsipa_pomu 3 hours ago | parent [-]

Well, my solution is a script and a systemd unit and timer files to run the script (the timer is just so that I can have it running 30 seconds after boot).