C. McEnroe
fd25c666d5
Add catsit-watch utility
2021-02-25 15:49:37 -05:00
C. McEnroe
8bd0b51140
Drop pledge privileges after daemonization
2021-02-01 14:47:32 -05:00
C. McEnroe
cc8a88c059
Remove use of "%n"
...
https://cvsweb.openbsd.org/src/lib/libc/stdio/vfprintf.c?rev=1.79&content-type=text/x-cvsweb-markup
I think this is silly, as I've said elsewhere, and it's a shame
because that was clearly the best way to write this. Oh well.
2021-02-01 11:39:25 -05:00
C. McEnroe
da4ccb18f4
Check signals first in the loop
...
Signals need to be checked first in the loop to catch any that were
delivered between setting up the signals handlers and entering the
loop, i.e. in the time it takes to initially start each of the
services.
2021-02-01 11:36:31 -05:00
C. McEnroe
7769a4f6e9
Log a message when stopping a service waiting to restart
...
It's a little annoying to have to special-case this, but otherwise there
is no confirmation in the log that the restart won't still happen.
2020-12-15 16:47:12 -05:00
C. McEnroe
b7ebd38698
Refactor unveil calls so errors can be reported properly
2020-11-10 15:15:43 -05:00
C. McEnroe
5b1a5f2876
Do not increment signals
...
No need to do a read and a write... and it's declared volatile so maybe
that's even worse? I don't even know, but there's no point.
2020-10-27 08:36:25 -04:00
C. McEnroe
363ab9f834
Only look up group if one is named
2020-10-23 11:37:10 -04:00
C. McEnroe
87083ad381
Remove default defines of RUNDIR, ETCDIR
2020-10-23 11:22:17 -04:00
C. McEnroe
8f81318a3f
Set shell scripts executable in build
2020-10-23 11:14:02 -04:00
C. McEnroe
d90a43d948
Humanize milliseconds if interval is less than 1s
...
The intervals are configurable in milliseconds so humanize should be
able to display at that precision.
2020-10-20 20:56:06 -04:00
C. McEnroe
1832301862
Humanize restart interval
2020-10-20 19:56:56 -04:00
C. McEnroe
324f569ce0
Document default catsit.conf location on OpenBSD
2020-08-17 23:59:08 -04:00
C. McEnroe
08783bd1cc
Template catsit script with RUNDIR
2020-08-17 23:25:34 -04:00
C. McEnroe
2a7467647e
Clean up includes
2020-08-17 22:49:29 -04:00
C. McEnroe
e548219ebf
Log service uptime in status
2020-08-17 22:39:54 -04:00
C. McEnroe
533c95c321
Add copy of AGPLv3
2020-08-17 22:20:53 -04:00
C. McEnroe
9612da73e9
Document target platforms
...
I really want to avoid adding a README...
2020-08-17 18:22:42 -04:00
C. McEnroe
6f74d88067
Remove useless setprogname call
2020-08-17 18:17:41 -04:00
C. McEnroe
325a92645f
Add OpenBSD rc script
2020-08-17 17:50:00 -04:00
C. McEnroe
32d048f326
Use BSD make syntax to configure for OpenBSD
2020-08-17 17:22:00 -04:00
C. McEnroe
296e40887b
Use pledge(2) and unveil(2) on OpenBSD
2020-08-17 16:38:22 -04:00
C. McEnroe
ebd44fb606
Use a separate fd for the fake fifo writer
...
From OpenBSD open(2):
> A FIFO should either be opened with O_RDONLY or with O_WRONLY. The
> behavior for opening a FIFO with O_RDWR is undefined.
2020-08-17 16:21:34 -04:00
C. McEnroe
ea96ef48cb
Use a non-blocking lock on the PID file
2020-08-17 16:06:40 -04:00
C. McEnroe
620735523f
Truncate PID file after opening and locking
2020-08-17 15:59:45 -04:00
C. McEnroe
00e35a1031
Simplify parseConfig error handling
2020-08-17 15:49:19 -04:00
C. McEnroe
41f9a167e3
Properly handle command line truncation
...
Unlikely to happen since ARG_MAX is 256K, but...
2020-08-17 12:57:50 -04:00
C. McEnroe
84b2c1858a
Flesh out documentation and improve examples
2020-08-17 01:11:44 -04:00
C. McEnroe
6302579f22
Add drop command
2020-08-16 23:01:25 -04:00
C. McEnroe
f9cfab1e0d
Only call setgroups as root
...
setgroups fails when already running as a user.
2020-08-16 22:20:14 -04:00
C. McEnroe
daac7db044
Don't set LOGNAME
...
LOGNAME is a SysV thing. This is a BSD program.
2020-08-16 17:32:23 -04:00
C. McEnroe
7d04a0f5e0
Add privileged services
...
This allows running things like kfcgi which do their own privilege
dropping and chrooting. Need to update the examples with something like
that.
2020-08-16 17:28:57 -04:00
C. McEnroe
e381f7bbe3
Clear groups list for services
2020-08-16 16:13:43 -04:00
C. McEnroe
3fbe9b5933
Use process groups for services
...
This lets us properly signal services with child processes of their own.
2020-08-16 00:27:08 -04:00
C. McEnroe
844f34a0c1
Set title after reload
2020-08-16 00:04:55 -04:00
C. McEnroe
3e9e6cf3a5
Set title on control commands
...
If a control command starts a service, the title should be updated.
2020-08-15 23:48:29 -04:00
C. McEnroe
1c4dd05f40
Add 126 to hardcoded stop exits
...
> If a command is not found, the exit status shall be 127. If the
> command name is found, but it is not an executable utility, the exit
> status shall be 126. Applications that invoke utilities without using
> the shell should use these exit status values to report similar errors.
[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_02
2020-08-15 23:11:09 -04:00
C. McEnroe
1eb6eb6d37
Remove EX_CONFIG from default stopexits
...
I've used it for "remote" configuration which could change.
2020-08-15 22:03:01 -04:00
C. McEnroe
470e1ec7b6
Avoid "control named pipe" phrase
2020-08-15 18:54:47 -04:00
C. McEnroe
84a1f34b0c
Check if pipe is writable in wrapper
2020-08-15 18:46:28 -04:00
C. McEnroe
0d7303e75f
Parse config later
...
This is just to keep the list of open file descriptors tidier, since
parsing the config creates many pipes.
2020-08-15 18:40:51 -04:00
C. McEnroe
a6b78bc827
Only log signals other than SIGTERM
2020-08-15 18:36:30 -04:00
C. McEnroe
f7850dde39
Clarify restart interval in catsitd manual
2020-08-15 18:31:59 -04:00
C. McEnroe
8b9daf7d5d
Fix resetting restart interval with explicit restart
2020-08-15 18:28:20 -04:00
C. McEnroe
497cafbf0f
Add reset interval after which restart interval is reset
2020-08-15 18:25:40 -04:00
C. McEnroe
a2c5773b03
Log when service name pattern doesn't match
2020-08-15 17:50:19 -04:00
C. McEnroe
f67269202e
Add FreeBSD rc script
...
I'm expecting to also have an OpenBSD rc script.
2020-08-15 17:40:17 -04:00
C. McEnroe
1e1a848f22
Call setproctitle with number of services
2020-08-15 16:53:15 -04:00
C. McEnroe
6fb08baee3
Rename project to catsit
2020-08-15 16:40:15 -04:00
C. McEnroe
449b0918ce
Use only LOG_NOTICE and LOG_WARNING
...
These are the two priorities that go to a normal place
(/var/log/messages) by default.
2020-08-15 16:14:21 -04:00