From 629469581ec0a58ed8044db2c72e44a0ece85259 Mon Sep 17 00:00:00 2001 From: AlexAegis Date: Sat, 1 Jun 2024 19:56:05 +0200 Subject: [PATCH] fix(qbittorrentd): retry if mount point not ready --- .../resources/qbittorrentd.service | 6 ++++- modules/systemd/readme.md | 24 +++++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/modules/qbittorrent/resources/qbittorrentd.service b/modules/qbittorrent/resources/qbittorrentd.service index f607fa86..342d632c 100644 --- a/modules/qbittorrent/resources/qbittorrentd.service +++ b/modules/qbittorrent/resources/qbittorrentd.service @@ -1,13 +1,17 @@ [Unit] Description=qBittorrent Daemon Service After=network.target -ConditionPathIsMountPoint=/var/media +Requires=var-media.mount +StartLimitBurst=5 +StartLimitIntervalSec=300 [Service] User=torrent Group=media ExecStart=/usr/bin/qbittorrent-nox ExecStop=/usr/bin/killall -w qbittorrent-nox +RestartSec=5 +Restart=on-failure [Install] WantedBy=multi-user.target diff --git a/modules/systemd/readme.md b/modules/systemd/readme.md index d36682bd..1e3a9aaf 100644 --- a/modules/systemd/readme.md +++ b/modules/systemd/readme.md @@ -15,9 +15,9 @@ sudo systemd-analyze verify every service ## Expectations -If any user service changes, reload the daemon. [Partially possible] +If any user service changes, reload the daemon. \[Partially possible] -If any file that a service depends on changes, reload the service. [Handled +If any file that a service depends on changes, reload the service. \[Handled by the module] ## Auto daemon reload @@ -65,6 +65,16 @@ live. Path watchers watch inode changes, so changing the target of a symlink won't trigger it. However systemd follows sysmlinks if they are directly specified. +### Generated services + +There are a number of services that are automatically provided by `systemd` +for example ones that provide a requirable target for mount points to be +present. + +```sh +systemctl list-units --type=mount +``` + #### Example This will trigger the path entry when you `touch` the target of `a-symlink.sh` @@ -101,26 +111,26 @@ Wants=notify-restart@%N.service Examples: -- `%h` +* `%h` `$HOME` of the user. For root services it's always `/root` -- `%E` +* `%E` `$XDG_CONFIG_HOME` or `$HOME/.config` if not set. You can set it in `/etc/environment` for everyone or in a `*.conf` file inside `$HOME/.config/environment.d/` for a specific user. -- `%s` +* `%s` Shell of the user. Just use `/bin/sh` if you have a fast shell there. -- `%n` (`%N`, no suffix) +* `%n` (`%N`, no suffix) Full unit name. In case of `some-service@example.service`, it's `some-service`. -- `%i` (`%I`, unescaped) +* `%i` (`%I`, unescaped) Instance name. In case of `some-service@example.service`, it's `example`.