Skip to content

Commit 2e98a4a

Browse files
authored
Merge pull request #2266 from Gredin67/dev
ynh_config_add_systemd: mount and service can have same name
2 parents 81d68c3 + db3970f commit 2e98a4a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

helpers/helpers.v2.1.d/systemd

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
# Create a dedicated systemd config
2222
#
23-
# usage: ynh_config_add_systemd [--mount=mount] [--service=service] [--template=template]
24-
# | arg: --mount= - Mount name (optionnal)
25-
# | arg: --service= - Service name (optionnal, `$app` by default)
26-
# | arg: --template= - Name of template file (optionnal, this is 'systemd.service' by default, meaning `../conf/systemd.service` will be used as template)
23+
# usage: ynh_config_add_systemd [--mount=mount] [--service=service] [--template=templatename]
24+
# | arg: --mount= - Mount name (optional)
25+
# | arg: --service= - Service name (optional, `$app` by default)
26+
# | arg: --template= - Name of template file (optional, 'systemd.service' by default, meaning `../conf/systemd.service` will be used as template)
2727
#
2828
# This will use the template `../conf/<templatename>`.
2929
#
@@ -43,35 +43,35 @@ ynh_config_add_systemd() {
4343

4444
if [[ -n "$mount" ]]; then
4545
ynh_config_add --template="$template" --destination="/etc/systemd/system/$mount.mount"
46-
systemctl enable "$mount" --quiet
46+
systemctl enable "$mount.mount" --quiet
4747
else
4848
ynh_config_add --template="$template" --destination="/etc/systemd/system/$service.service"
49-
systemctl enable "$service" --quiet
49+
systemctl enable "$service.service" --quiet
5050
fi
5151
systemctl daemon-reload
5252
}
5353

5454
# Remove the dedicated systemd config
5555
#
5656
# usage: ynh_config_remove_systemd service
57-
# | arg: service - Service name (optionnal, $app by default)
57+
# | arg: service - Service name (optional, $app by default)
5858
ynh_config_remove_systemd() {
5959
local service="${1:-$app}"
6060
if [ -e "/etc/systemd/system/$service.service" ]; then
6161
ynh_systemctl --service="$service" --action=stop
62-
systemctl disable "$service" --quiet
62+
systemctl disable "$service.service" --quiet
6363
ynh_safe_rm "/etc/systemd/system/$service.service"
6464
systemctl daemon-reload
6565
fi
6666
if [ -e "/etc/systemd/system/$service.mount" ]; then
6767
ynh_systemctl --service="$service" --action=stop
68-
systemctl disable "$service" --quiet
68+
systemctl disable "$service.mount" --quiet
6969
ynh_safe_rm "/etc/systemd/system/$service.mount"
7070
systemctl daemon-reload
7171
fi
7272
}
7373

74-
# Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started
74+
# Start (or other actions) a service, print a log in case of failure and optionaly wait until the service is completely started
7575
#
7676
# usage: ynh_systemctl [--service=service] [--action=action] [ [--wait_until="line to match"] [--log_path=log_path] [--timeout=300] [--length=20] ]
7777
# | arg: --service= - Name of the service to start. Default : `$app`

0 commit comments

Comments
 (0)