Browse Source

Make services automatically restart on stop by default

Also, document the behavior. Previously, there was nothing
actually specifying what the default is.

Fixes https://github.com/davmac314/dinit/issues/168
Daniel Kolesa 1 year ago
parent
commit
63b3c8a6e2

+ 1 - 0
doc/manpages/dinit-service.5.m4

@@ -173,6 +173,7 @@ The path specified is subject to variable substitution (see \fBVARIABLE SUBSTITU
 Indicates whether the service should automatically restart if it stops, including due to
 unexpected process termination or a dependency stopping.
 Note that if a service stops due to user request, automatic restart is inhibited.
+The default is to automatically restart.
 .TP
 \fBsmooth\-recovery\fR = {yes | true | no | false}
 Applies only to \fBprocess\fR and \fBbgprocess\fR services.

+ 1 - 0
src/igr-tests/basic/sd/basic

@@ -1,2 +1,3 @@
 type = process
 command = ./basic.sh
+restart = false

+ 1 - 0
src/igr-tests/chain-to/sd/part1

@@ -1,3 +1,4 @@
 type = process
 command = ./record-param.sh part1
 chain-to = part2
+restart = false

+ 1 - 0
src/igr-tests/chain-to/sd/part2

@@ -1,3 +1,4 @@
 type = process
 command = ./record-param.sh part2
 chain-to = part3
+restart = false

+ 1 - 0
src/igr-tests/chain-to/sd/part3

@@ -2,3 +2,4 @@ type = process
 options = always-chain
 command = ./record-param.sh part3
 chain-to = part4
+restart = false

+ 1 - 0
src/igr-tests/chain-to/sd/part4

@@ -2,3 +2,4 @@ type = process
 #options = always-chain
 command = ./record-param.sh part4
 chain-to = part5
+restart = false

+ 1 - 0
src/igr-tests/chain-to/sd/part5

@@ -1,2 +1,3 @@
 type = process
 command = ./record-param.sh part5
+restart = false

+ 1 - 0
src/igr-tests/environ/sd/checkenv

@@ -1,2 +1,3 @@
 type = process
 command = ./checkenv.sh
+restart = false

+ 1 - 0
src/igr-tests/environ/sd/setenv1

@@ -1,3 +1,4 @@
 type = process
 command = ./setenv.sh setenv1
 depends-on = setenv2
+restart = false

+ 1 - 0
src/igr-tests/ps-environ/sd/checkenv1

@@ -1,3 +1,4 @@
 type = process
 command = ./checkenv.sh
 env-file = ./environment1
+restart = false

+ 1 - 0
src/igr-tests/ps-environ/sd/checkenv2

@@ -1,3 +1,4 @@
 type = process
 command = ./checkenv.sh
 env-file = ./environment2
+restart = false

+ 1 - 0
src/igr-tests/ps-environ/sd/checkenv3

@@ -1,3 +1,4 @@
 type = process
 command = ./checkenv2.sh
 env-file = ./environment3
+restart = false

+ 1 - 0
src/igr-tests/ps-environ/sd/checkenv4

@@ -1,3 +1,4 @@
 type = process
 command = ./checkenv2.sh
 env-file = ./environment4
+restart = false

+ 1 - 0
src/igr-tests/restart/sd/basic

@@ -1,2 +1,3 @@
 type = process
 command = ./basic.sh
+restart = false

+ 1 - 0
src/igr-tests/svc-start-fail/sd/bad-command

@@ -1,2 +1,3 @@
 type = process
 command = /bad-command-which-does-not-exist
+restart = false

+ 1 - 0
src/igr-tests/var-subst/sd/checkargs

@@ -1,3 +1,4 @@
 type = process
 command = ./checkargs.sh xxx$TEST_VAR_ONE/yyy $TEST_VAR_TWO$TEST_VAR_THREE
 load-options = sub-vars
+restart = false

+ 1 - 1
src/includes/load-service.h

@@ -764,7 +764,7 @@ class service_settings_wrapper
     unsigned max_log_buffer_sz = 4096;
     service_flags_t onstart_flags;
     int term_signal = SIGTERM;  // termination signal
-    bool auto_restart = false;
+    bool auto_restart = true;
     bool smooth_recovery = false;
     string socket_path;
     int socket_perms = 0666;