Skip to content

Commit 310c352

Browse files
authored
Merge pull request #136 from thin-edge/fix-only-restart-service-if-enabled
fix(init): only restart service if it is enabled
2 parents 68e9b8a + c489c19 commit 310c352

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

images/common/config/bootstrap/post.d/10-start-services.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ control_service() {
99
name="$1"
1010
action="$2"
1111
if command -v systemctl >/dev/null 2>&1; then
12-
echo "Enable/$action $name"
13-
sudo systemctl enable "$name"
14-
15-
if [ -d /run/systemd/system ]; then
12+
echo "$action $name"
13+
if [ -d /run/systemd/system ] && systemctl -q is-enabled "$name"; then
1614
sudo systemctl "$action" "$name"
1715
fi
1816
fi

0 commit comments

Comments
 (0)