diff options
Diffstat (limited to 'src/genrc.8')
-rw-r--r-- | src/genrc.8 | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/src/genrc.8 b/src/genrc.8 index 00522ee..959a00e 100644 --- a/src/genrc.8 +++ b/src/genrc.8 | |||
@@ -13,7 +13,7 @@ | |||
13 | .\" | 13 | .\" |
14 | .\" You should have received a copy of the GNU General Public License | 14 | .\" You should have received a copy of the GNU General Public License |
15 | .\" along with genrc. If not, see <http://www.gnu.org/licenses/>. | 15 | .\" along with genrc. If not, see <http://www.gnu.org/licenses/>. |
16 | .TH GENRC 8 "May 17, 2018" "GENRC" "Genrc User Manual" | 16 | .TH GENRC 8 "May 20, 2018" "GENRC" "Genrc User Manual" |
17 | .SH NAME | 17 | .SH NAME |
18 | genrc \- generic system initialization script helper | 18 | genrc \- generic system initialization script helper |
19 | .SH SYNOPSIS | 19 | .SH SYNOPSIS |
@@ -36,6 +36,8 @@ genrc \- generic system initialization script helper | |||
36 | [\fB\-\-pid\-from=\fISOURCE\fR]\ | 36 | [\fB\-\-pid\-from=\fISOURCE\fR]\ |
37 | [\fB\-\-pidfile=\fIPIDFILE\fR]\ | 37 | [\fB\-\-pidfile=\fIPIDFILE\fR]\ |
38 | [\fB\-\-program=\fIPROGRAM\fR]\ | 38 | [\fB\-\-program=\fIPROGRAM\fR]\ |
39 | [\fB\-\-restart\-on\-exit=\fR[\fB!\fR]\fISTATUS\fR[\fB,\fISTATUS\fR...]]\ | ||
40 | [\fB\-\-restart\-on\-signal=\fR[\fB!\fR]\fISIG\fR[\fB,\fISIG\fR...]]\ | ||
39 | [\fB\-\-sentinel\fR]\ | 41 | [\fB\-\-sentinel\fR]\ |
40 | [\fB\-\-signal\-reload=\fISIG\fR]\ | 42 | [\fB\-\-signal\-reload=\fISIG\fR]\ |
41 | [\fB\-\-signal\-stop=\fISIG\fR]\ | 43 | [\fB\-\-signal\-stop=\fISIG\fR]\ |
@@ -101,6 +103,30 @@ If the \fB\-\-create\-pidfile=\fIFILENAME\fR option is given together with | |||
101 | in \fIFILE\fR. The file will be unlinked after the subsidiary command | 103 | in \fIFILE\fR. The file will be unlinked after the subsidiary command |
102 | terminates. Unless the \fB\-\-pid\-from\fR option is given, | 104 | terminates. Unless the \fB\-\-pid\-from\fR option is given, |
103 | \fB\-\-pid\-from=FILE:\fIFILENAME\fR will be assumed. | 105 | \fB\-\-pid\-from=FILE:\fIFILENAME\fR will be assumed. |
106 | .PP | ||
107 | In sentinel mode, it is possible to restart the program if it | ||
108 | terminates with a specific exit code or on a specific signal. This is | ||
109 | controlled by the \fB\-\-restart\-on\-exit\fR and | ||
110 | \fB\-\-restart\-on\-signal\fR options. Use this feature to ensure the | ||
111 | service provided by the program won't get terminated because of | ||
112 | hitting a bug or encountering an unforeseen external condition. For | ||
113 | example, the following two options will ensure that the program will | ||
114 | be terminated only if it exits with status 0 or it is terminated by | ||
115 | SIGTERM or SIGQUIT signal: | ||
116 | .EX | ||
117 | --restart-on-exit='!0' --restart-on-signal='!TERM,QUIT' | ||
118 | .EE | ||
119 | .PP | ||
120 | If restarts are requested, \fBgenrc\fR will control how often it has | ||
121 | to restart the program using the same algorithm as | ||
122 | .B init (8). | ||
123 | Namely, if the program is restarted more than 10 times within two | ||
124 | minutes, \fBgenrc\fR will disable subsequent restarts for the next | ||
125 | 5 minutes. If the \fB\-\-create\-pidfile\fR option was used, the | ||
126 | PID of the controlling \fBgenrc\fR process will be stored in the | ||
127 | file during that interval. If the \fBSIGHUP\fR signal is delivered | ||
128 | during the sleep interval, the sleep will be broken prematurely and | ||
129 | the program restarted again. | ||
104 | .SS status | 130 | .SS status |
105 | In \fBstatus\fR mode \fBgenrc\fR verifies if the \fICOMMAND\fR is | 131 | In \fBstatus\fR mode \fBgenrc\fR verifies if the \fICOMMAND\fR is |
106 | already running and outputs its status on the standard output. To this | 132 | already running and outputs its status on the standard output. To this |
@@ -188,9 +214,37 @@ Name of the program to run. | |||
188 | \fB\-P\fR, \fB\-\-pid\-from=\fISOURCE\fR | 214 | \fB\-P\fR, \fB\-\-pid\-from=\fISOURCE\fR |
189 | Where to look for PIDs of the running programs. | 215 | Where to look for PIDs of the running programs. |
190 | .TP | 216 | .TP |
217 | \fB\-\-restart\-on\-exit=\fR[\fB!\fR]\fISTATUS\fR[\fB,\fISTATUS\fR...] | ||
218 | This option takes effect when used together with | ||
219 | \fB\-\-sentinel\fR. If the program terminates with one of status | ||
220 | codes listed as the argument to this option, it will be immediately | ||
221 | restarted. The exclamation mark at the start of the list inverts the | ||
222 | set, e.g. \fB\-\-restart\-on\-exit='!0,1'\fR means restart unless the | ||
223 | program exit code is 0 or 1. Note the use of quotation to prevent the | ||
224 | \fB!\fR from being interpreted by the shell. | ||
225 | .TP | ||
226 | \fB\-\-restart\-on\-signal=\fR[\fB!\fR]\fISIG\fR[\fB,\fISIG\fR...] | ||
227 | This option takes effect when used together with | ||
228 | \fB\-\-sentinel\fR. If the program terminates due to receiving one of | ||
229 | the signals from this list, it will be immediately restarted. Each | ||
230 | \fISIG\fR is either a signal number, or a signal name, as listed in | ||
231 | .BR signal (7). | ||
232 | The \fBSIG\fR prefix can be omitted from the signal name. Names are | ||
233 | case-insensitive. Thus, \fB1\fR, \fBHUP\fR, \fBSIGHUP\fR, and | ||
234 | \fBsighup\fR all stand for the same signal. | ||
235 | .sp | ||
236 | The exclamation mark at the start of the list complements the signal | ||
237 | set, so that e.g. \fB\-\-restart\-on\-signal='!TERM,QUIT,INT'\fR will | ||
238 | restart the program unless it terminates on one of the listed signals. | ||
239 | .TP | ||
191 | \fB\-\-sentinel\fR | 240 | \fB\-\-sentinel\fR |
192 | \fIPROGRAM\fR runs in foreground; disconnect from the controlling | 241 | \fIPROGRAM\fR runs in foreground; disconnect from the controlling |
193 | terminal, run it and act as a sentinel. | 242 | terminal, start it and run in background until it terminates. The |
243 | program's stdout and stderr are sent to the syslog facility | ||
244 | \fBdaemon\fR, priorities \fBinfo\fR and \fBerr\fR, correspondingly. | ||
245 | |||
246 | See the options \fB\-\-restart\-on\-exit\fR and | ||
247 | \fB\-\-restart\-on\-signal\fR for details on how to restart the program. | ||
194 | .TP | 248 | .TP |
195 | \fB\-\-signal\-reload=\fISIG\fR | 249 | \fB\-\-signal\-reload=\fISIG\fR |
196 | Signal to send on reload (default: \fBSIGHUP\fR). Setting it to 0 is | 250 | Signal to send on reload (default: \fBSIGHUP\fR). Setting it to 0 is |