OpenRC
Info
OpenRC is an init system designed for Unix-like OS. Each service is defined by a small text file, called a unit file, which containing instructions on how to run the service. It's notably the default init system for Alpine and Gentoo.
To create an OpenRC service, you just need to add an init file at /etc/init.d/tinyfeed
.
Then, you can enable the service with rc-update add tinyfeed default
and start or stop it with rc-service tinyfeed <COMMAND>
. Below, you can find the most minimal service file that will enable you to start and stop tinyfeed with the feed list and rendered page located at /etc/tinyfeed
.
#!/sbin/openrc-run
depend() {
need net
use dns
}
command="/usr/local/bin/tinyfeed"
command_args="--daemon -i /etc/tinyfeed/feeds.txt -o /etc/tinyfeed/index.html"
command_background=true
pidfile="/run/${RC_SVCNAME}.pid"
For more advanced patterns (like running as your user instead of root), you can check out the official OpenRC documentation on the subject or Gentoo wiki and Alpine user handbook