|diamondburned d3b71cc437||8 months ago|
|cronmon||8 months ago|
|.drone.yml||8 months ago|
|LICENSE.md||8 months ago|
|README.md||8 months ago|
|go.mod||8 months ago|
|go.sum||8 months ago|
|main.go||8 months ago|
A lightweight service manager that monitors itself using crond. Designed to be used where a service manager is not available.
CGO_ENABLED=0 go build).
For a detailed explanation of how cronmon works exactly, see its documentation.
Cronmon uses two features that makes it only work on Linux:
PR_SET_CHILD_SUBREAPER. The usage of
these two features are documented in the above documentation.
go install git.unix.lgbt/diamondburned/cronmon.
A cron file can be generated by running
cronmon cron. Below is a simple
# Start cronmon immediately on startup. @reboot /tmp/cronmon # Monitor cronmon's status every minute. * * * * * /tmp/cronmon
This cron file will launch cronmon with the journal file pointing to
~/.config/cronmon/journal.json and the scripts (service) directory pointing to
$ # Shell script example. $ cat <<'EOF' > ~/.cronmon/scripts/sysmetd.sh #!/bin/sh exec sysmet -flag "$shell_env" -listen unix:///tmp/a.sock EOF $ chmod +x ~/.cronmon/scripts/sysmetd.sh $ $ # Executable example. $ wget -O ~/.cronmon/scripts/example https://dodgy.site/executable $ chmod +x ~/.cronmon/scripts/example
New service files will automatically be executed, and old service files that are
updated will automatically restart the process. Removing a service file will
stop the process. Removing the executable bit from a file (
chmod -x) makes
cronmon stop the process as well. Adding back the bit (
chmod +x) makes it
start the process again.