(no title)
klapinat0r | 9 years ago
Here's what I'd call a simple init.d-like example. non-needed things (if you think it's too complex) include: wait for fs mount and network, custom reload command, "don't log stdout"
[Unit]
After=network.target
AssertPathIsMountPoint=/mnt/service-data-if-needed
[Service]
ExecStart=/some/binary
Environment=CONF=/etc/i/guess.conf USER=nonrootmaybe
ExecReload=/bin/pkill binary
KillMode=process
Restart=always
StandardOutput=null
[Install]
WantedBy=multi-user.target
EDIT: man 5 systemd.unit
dingaling|9 years ago
That only guarantees that your network devices have been enumerated, not that they are available with assigned addresses.
I encountered this problem with SSH failing to start on Ubuntu 16.04 server. systemd was launching SSH before the binding address had been assigned, causing SSH to abort and fail and the server to continue to boot without any way of accessing it remotely.
Workaround ( at the physical console ) was to add a Retry to the SSH unit and time it to coincide with the address having been assigned[0]. hacky, but no other unit imperatives worked.
[0] Default behaviour in the SSH unit, at least on Ubuntu, is that it tries once and never again.
digi_owl|9 years ago
Also, i expect the faithful to come and claim it is a Canonical fuckup.
int0x80|9 years ago
klapinat0r|9 years ago
If we're comparing running a binary on startup vs. setting it up as a service in systemd, I wholeheartedly agree that you should always use the right tool for the job. So let's discuss the software, not the politics :)
If we're talking about the original story (crontab) people should compare it to systemd timers if they're looking for alternatives - which I still prefer.
I have no stake in OSes choice of default installed packages (be it init, openrc, or systemd), and agree with your parent comment that OSes shouldn't break (dropping crontab as an installed base package) without consideration.
I haven't come across one of these OSes where it wasn't possible to install crontab from their default package managers, and in their main repositories, though.