Systemd service to start only after CIFS mount
3
votes
2
answers
661
views
I have a little home server (an old PC really) running a few services
under Proxmox hypervisor, one of which is the qBittorrent server.
It is installed in a separate LXC container, on an Ubuntu 24.04 base system.
All downloads are saved on a separate local home-made PI-based NAS share that is mounted inside the qBittorrent container using CIFS in fstab, on
/mnt/Vault
.
My problem is, every time I need to restart the qBT container, the torrents will throw a "missing files" error, as, I think, the "qBittorrent-nox" service starts quicker than the NAS share gets mounted inside the container.
It seems simply a matter of the qBT service being faster than the mount –
and so it didn't find the necessary files in time.
Afterwards, when I check the mount, it is there,
so I can eliminate any mounting issues, other than not being fast enough.
So, is it possible to somehow define a condition in the qBT service file
to wait and start only after the mount is present?
Here is the service file:
[Unit]
Description=qBittorrent Command Line Client
After=network.target
[Service]
Type=forking
User=root
Group=qbittorrent-nox
UMask=007
ExecStart=/usr/bin/qbittorrent-nox -d --webui-port=8080
Restart=on-failure
[Install]
WantedBy=multi-user.target
I'm thinking the After
directive under the Unit
section,
but I'm not sure.
Somehow, I should maybe incorporate a response from fstab in there,
to confirm that all mounts were successful?
Any ideas how to put this in practice?
My Linux skills are limited, so I'll do my best to follow any proposals.
Asked by Radu Erdei
(131 rep)
Dec 22, 2024, 08:13 AM
Last activity: Dec 22, 2024, 09:00 PM
Last activity: Dec 22, 2024, 09:00 PM