1 |
commit: aacf841de4983ab33755081a6f69cdf5e3a47007 |
2 |
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com> |
3 |
AuthorDate: Mon Oct 22 22:49:25 2018 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Oct 22 22:49:25 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=aacf841d |
7 |
|
8 |
supervise-daemon-guide.md: re-format and add more variables |
9 |
|
10 |
supervise-daemon-guide.md | 65 ++++++++++++++++++++++++++++++++++------------- |
11 |
1 file changed, 47 insertions(+), 18 deletions(-) |
12 |
|
13 |
diff --git a/supervise-daemon-guide.md b/supervise-daemon-guide.md |
14 |
index ec885e71..0b15a858 100644 |
15 |
--- a/supervise-daemon-guide.md |
16 |
+++ b/supervise-daemon-guide.md |
17 |
@@ -7,44 +7,73 @@ terminates unexpectedly. |
18 |
|
19 |
The following is a brief guide on using this capability. |
20 |
|
21 |
-## Use Default start, stop and status functions |
22 |
+* Use Default start, stop and status functions |
23 |
+ If you write your own start, stop and status functions in your service |
24 |
+ script, none of this will work. You must allow OpenRC to use the default |
25 |
+ functions. |
26 |
|
27 |
-If you write your own start, stop and status functions in your service |
28 |
-script, none of this will work. You must allow OpenRC to use the default |
29 |
-functions. |
30 |
+* Daemons must not fork |
31 |
+ Any deamon that you would like to have monitored by supervise-daemon |
32 |
+ must not fork. Instead, it must stay in the foreground. If the daemon |
33 |
+ forks, the supervisor will be unable to monitor it. |
34 |
|
35 |
-## Daemons must not fork |
36 |
+ If the daemon can be configured to not fork, this should be done in the |
37 |
+ daemon's configuration file, or by adding a command line option that |
38 |
+ instructs it not to fork to the command_args_foreground variable shown |
39 |
+ below. |
40 |
|
41 |
-Any deamon that you would like to have monitored by supervise-daemon |
42 |
-must not fork. Instead, it must stay in the foreground. If the daemon |
43 |
-itself forks, the supervisor will be unable to monitor it. |
44 |
- |
45 |
-If the daemon can be configured to not fork, this should be done in the |
46 |
-daemon's configuration file, or by adding a command line option that |
47 |
-instructs it not to fork to the command_args_foreground variable shown |
48 |
-below. |
49 |
- |
50 |
-## Variable Settings |
51 |
+# Variable Settings |
52 |
|
53 |
The most important setting is the supervisor variable. At the top of |
54 |
your service script, you should set this variable as follows: |
55 |
|
56 |
+``` sh |
57 |
supervisor=supervise-daemon |
58 |
+``` |
59 |
|
60 |
Several other variables affect the way services behave under |
61 |
supervise-daemon. They are documented on the openrc-run man page, but I |
62 |
will list them here for convenience: |
63 |
|
64 |
+``` sh |
65 |
pidfile=/pid/of/supervisor.pid |
66 |
+``` |
67 |
|
68 |
If you are using start-stop-daemon to monitor your scripts, the pidfile |
69 |
is the path to the pidfile the daemon creates. If, on the other hand, |
70 |
you are using supervise-daemon, this is the path to the pidfile the |
71 |
supervisor creates. |
72 |
|
73 |
-command_args_foreground should be used if the daemon you want to monitor |
74 |
+``` sh |
75 |
+command_args_foreground="arguments" |
76 |
+``` |
77 |
+ |
78 |
+This should be used if the daemon you want to monitor |
79 |
forks and goes to the background by default. This should be set to the |
80 |
command line option that instructs the daemon to stay in the foreground. |
81 |
|
82 |
-This is very early support, so feel free to file bugs if you have |
83 |
-issues. |
84 |
+``` sh |
85 |
+respawn_delay |
86 |
+``` |
87 |
+ |
88 |
+This is the number of seconds to delay before attempting to respawn a |
89 |
+supervised process after it dies unexpectedly. |
90 |
+The default is to respawn immediately. |
91 |
+ |
92 |
+``` sh |
93 |
+respawn_max=x |
94 |
+``` |
95 |
+ |
96 |
+This is the maximum number of times to respawn a supervised process |
97 |
+during the given respawn period. The default is unlimited. |
98 |
+ |
99 |
+``` sh |
100 |
+respawn_period=seconds |
101 |
+``` |
102 |
+ |
103 |
+This works in conjunction with respawn_max and respawn_delay above to |
104 |
+decide if a process should not be respawned for some reason. |
105 |
+ |
106 |
+For example, if respawn_period is 60, respawn_max is 2 and respawn_delay |
107 |
+is 3 and a process dies more than 4 times, the process will not be |
108 |
+respawned and the supervisor will terminate. |