You are not logged in.
I'm trying to prevent deluged starting without the NFS mount present.
I have an NFS mount at /mnt/bittorrent, which I've temporarily commented out in /etc/fstab.
My config for deluged is as follows:
# systemctl cat deluged.service
# /usr/lib/systemd/system/deluged.service
[Unit]
Description=Deluge Daemon
After=network.target
[Service]
User=deluge
ExecStart=/usr/bin/deluged -d
UMask=0002
[Install]
WantedBy=multi-user.target
# /etc/systemd/system/deluged.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/bin/deluged -d -L info -l /var/log/deluge.log
Nice=19
[Unit]
Requires=mnt-bittorrent.mount
It looks like dependencies are correct:
# systemctl list-dependencies deluged
deluged.service
● ├─mnt-bittorrent.mount
● ├─system.slice
● └─sysinit.target
● ├─dev-hugepages.mount
● ├─dev-mqueue.mount
...
And yet, after reboot:
# systemctl status deluged
● deluged.service - Deluge Daemon
Loaded: loaded (/usr/lib/systemd/system/deluged.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/deluged.service.d
└─override.conf
Active: active (running) since Thu 2019-02-21 21:07:12 AEST; 1min 42s ago
Main PID: 286 (deluged)
Tasks: 7 (limit: 1042)
Memory: 57.1M
CGroup: /system.slice/deluged.service
└─286 /usr/bin/python2 /usr/bin/deluged -d -L info -l /var/log/deluge.log
Feb 21 21:07:12 sinclair systemd[1]: Started Deluge Daemon.
# systemd-analyze critical-chain deluged.service
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.
deluged.service @13.593s
└─network.target @13.323s
└─dhcpcd@eth0.service @10.039s +3.245s
└─sys-subsystem-net-devices-eth0.device @9.973s
And /mnt/bittorrent is not mounted.
When I stop and start deluged this happens:
# systemctl stop deluged
# systemctl start deluged
Failed to start deluged.service: Unit mnt-bittorrent.mount not found.
Why does it start on boot but not manually??
Last edited by tedd (2019-02-22 02:48:23)
Offline
[Unit]
RequiresMountsFor=/mnt/bittorent
Offline
You can also try
[Unit]
BindsTo=mnt-bittorrent.mount
After=mnt-bittorrent.mount
That however does not answer why it starts on boot but not manually. It may relate to having commented the NFS mount in /etc/fstab, then mnt-bittorrent.mount becomes an inexistent (not-found) unit, and systemd somehow handles inexistent units differently on boot.
Offline
[Unit] RequiresMountsFor=/mnt/bittorent
You can also try
[Unit] BindsTo=mnt-bittorrent.mount After=mnt-bittorrent.mount
Thank you both for your suggestions. edacval's suggestion didn't work, but rcasa's did. When the NFS mountpoint is not mounted (or doesn't exist, in this case), using BindsTo= ensures that the daemon doesn't start. SystemD logs an error, but I guess that's ok.
I wasn't aware that Requires= is not a hard dependency and I still don't understand why there's a difference between boot and manual daemon starting.
Offline