6 systemd-analyze log-level debug
7 systemd-analyze log-target console
10 SERVICE_PATH
="$(mktemp /etc/systemd/system/execreloadXXX.service)"
11 SERVICE_NAME
="${SERVICE_PATH##*/}"
13 echo "[#1] Failing ExecReload= should not kill the service"
14 cat > "$SERVICE_PATH" << EOF
16 ExecStart=/bin/sleep infinity
20 systemctl daemon-reload
21 systemctl start
$SERVICE_NAME
22 systemctl status
$SERVICE_NAME
23 # The reload SHOULD fail but SHOULD NOT affect the service state
24 ! systemctl reload
$SERVICE_NAME
25 systemctl status
$SERVICE_NAME
26 systemctl stop
$SERVICE_NAME
29 echo "[#2] Failing ExecReload= should not kill the service (multiple ExecReload=)"
30 cat > "$SERVICE_PATH" << EOF
32 ExecStart=/bin/sleep infinity
38 systemctl daemon-reload
39 systemctl start
$SERVICE_NAME
40 systemctl status
$SERVICE_NAME
41 # The reload SHOULD fail but SHOULD NOT affect the service state
42 ! systemctl reload
$SERVICE_NAME
43 systemctl status
$SERVICE_NAME
44 systemctl stop
$SERVICE_NAME
46 echo "[#3] Failing ExecReload=- should not affect reload's exit code"
47 cat > "$SERVICE_PATH" << EOF
49 ExecStart=/bin/sleep infinity
50 ExecReload=-/bin/false
53 systemctl daemon-reload
54 systemctl start
$SERVICE_NAME
55 systemctl status
$SERVICE_NAME
56 systemctl reload
$SERVICE_NAME
57 systemctl status
$SERVICE_NAME
58 systemctl stop
$SERVICE_NAME
60 systemd-analyze log-level info