summary refs log tree commit diff
path: root/catsitd.8
blob: 76d3ef9d896455613db81acf9add21c71d250b93 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
.Dd August 15, 2020
.Dt CATSITD 8
.Os
.
.Sh NAME
.Nm catsitd
.Nd process supervisor
.
.Sh SYNOPSIS
.Nm
.Op Fl d
.Op Fl C Ar path
.Op Fl c Ar control
.Op Fl f Ar config
.Op Fl g Ar group
.Op Fl p Ar pidfile
.Op Fl r Ar reset
.Op Fl s Ar stopexits
.Op Fl t Ar restart
.Op Fl u Ar user
.
.Sh DESCRIPTION
The
.Nm
daemon
is a supervisor for processes
with the following behavior:
.Bl -enum
.It
The process runs in the foreground,
not as a daemon.
.It
The process logs to standard output or standard error.
.It
The process handles errors by exiting
and expects to be restarted.
.It
The process indicates its reason for exiting with
.Xr sysexits 3 .
.El
.
.Pp
The
.Nm
daemon spawns processes for a list of
.Em services ,
redirects their output to syslog,
and restarts the processes when they exit
according to their exit status.
Exponential backoff is applied to restarts.
.
.Pp
The list of services is defined in a
.Xr catsit.conf 5
file.
The services managed by
.Nm
can be controlled
through a named pipe.
The
.Xr catsit 8
utility is a wrapper
around the named pipe,
and its manual page
describes the control command format.
.
.Pp
The arguments are as follows:
.Bl -tag -width Ds
.It Fl C Ar path
Change directory to
.Ar path
before starting services.
By default the working directory is
.Pa / .
.
.It Fl c Ar control
Set the path of the named pipe
used for control.
.
.It Fl d
Do not run as a daemon.
.
.It Fl f Ar config
Set the path of the
.Xr catsit.conf 5
file.
.
.It Fl g Ar group
Change group to
.Ar group
before starting services.
If
.Fl u
is used,
the default group is the user's group.
.
.It Fl p Ar pidfile
Write the PID of the
.Nm
process to
.Ar pidfile .
.
.It Fl r Ar reset
Set the interval in milliseconds
for which a process must live
to have its service restart interval
reset to the initial value.
The default interval is 15 minutes.
.
.It Fl s Ar stopexits
Set the list of exit statuses
for which a restart will not be attempted.
The
.Ar stopexits
argument is a comma-separated list of integers.
The default list contains the values of
.Dv EX_USAGE ,
.Dv EX_DATAERR ,
.Dv EX_NOINPUT ,
.Dv EX_OSFILE ,
.Dv EX_CANTCREAT ,
.Dv EX_CONFIG
defined in
.Xr sysexits 3 .
The exit status 127
is always treated as a stop exit.
.
.It Fl t Ar restart
Set the initial interval in milliseconds
between automatic restarts.
This interval is doubled
each time a service
is automatically restarted.
The default interval is 1 second.
.
.It Fl u Ar user
Change user to
.Ar user
before starting services.
.El
.
.Pp
When the
.Nm
daemon receives the
.Dv HUP
signal,
the
.Xr catsit.conf 5
file is reloaded.
Modified services
are not automatically restarted,
newly added services
are not automatically started,
and removed services
are not automatically stopped.
.
.Pp
When the
.Nm
daemon receives the
.Dv TERM
signal,
the control named pipe is closed,
all services are stopped,
and
.Nm
exits.
.
.Sh ENVIRONMENT
Services are started
with empty environments
apart from the following:
.Bl -tag -width Ds
.It Ev LOGNAME , Ev USER
Set to the name of the user specified by
.Fl u .
.It Ev HOME
Set to the home directory of the user specified by
.Fl u .
.It Ev SHELL
Set to
.Pa /bin/sh .
.It Ev PATH
Set to the system default defined by
.Dv _PATH_DEFPATH
in
.In paths.h .
.El
.
.Sh FILES
.Bl -tag -width Ds
.It Pa /usr/local/etc/catsit.conf
The default path of the
.Xr catsit.conf 5
file.
.It Pa /var/run/catsitd.pipe
The default path of the named pipe
used for control.
.El
.
.Sh SEE ALSO
.Xr catsit.conf 5 ,
.Xr catsit 8
.
.Sh AUTHORS
.An June Bug Aq Mt june@causal.agency