summary refs log tree commit diff
path: root/catsitd.8
blob: ae895315530ebdb3b00bc15b9a7b8914bc8fd0db (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
209
210
211
212
213
214
215
216
.Dd August 16, 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 automatic 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
for writing to the named pipe,
and its manual page
describes the control command syntax.
.
.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 service control.
.
.It Fl d
Do not run as a daemon.
Log to standard error
as well as syslog.
.
.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 set,
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
and
.Dv EX_CANTCREAT
defined in
.Xr sysexits 3 .
The exit statuses 126 and 127
are always treated as stop exits.
.
.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.
Services which are
.Em privileged
are started without changing user.
The
.Xr catsit.conf 5
manual page
describes privileged services.
.El
.
.Pp
The
.Nm
daemon takes the following actions
in response to signals:
.Bl -tag -width Ds
.It Dv HUP
The
.Xr catsit.conf 5
file is reloaded.
Services are not automatically
started, stopped or restarted.
Removed services can be dropped with
.Xr catsit 8 .
.
.It Dv TERM
The named pipe used for service control
is closed and unlinked.
All services are stopped,
after which
.Nm
exits.
.
.It Dv INFO
The current status of all services is logged.
.El
.
.Sh ENVIRONMENT
Services are started
with empty environments
apart from the following:
.Bl -tag -width Ds
.It 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 service control.
.El
.
.Sh SEE ALSO
.Xr catsit.conf 5 ,
.Xr catsit 8
.
.Sh AUTHORS
.An June Bug Aq Mt june@causal.agency