When a Condition*= fails, and a service has Restart=always,
the service is not restarted.
Follow the same behaviour for ExecCondition= to avoid inconsistencies.
Fixes #22257
return false;
case SERVICE_RESTART_ALWAYS:
- return true;
+ return s->result != SERVICE_SKIP_CONDITION;
case SERVICE_RESTART_ON_SUCCESS:
return s->result == SERVICE_SUCCESS;
--- /dev/null
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Unit]
+Description=Issue 22257 Repro with Restart=always
+
+[Service]
+Type=simple
+Restart=always
+ExecCondition=/bin/false
+ExecStart=sleep 100
+RestartSec=1
systemctl start testsuite-51-repro-1
systemctl start testsuite-51-repro-2
+systemctl start testsuite-51-repro-3
sleep 5 # wait a bit in case there are restarts so we can count them below
[[ "$(systemctl show testsuite-51-repro-1 -P NRestarts)" == "0" ]]
[[ "$(systemctl show testsuite-51-repro-2 -P NRestarts)" == "0" ]]
+[[ "$(systemctl show testsuite-51-repro-3 -P NRestarts)" == "0" ]]
touch /testok