-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add openrc support #7
Comments
logrotate
A specific The
sudo apk --no-cache add logrotate
ls -lAhF /etc/periodic/*/*logrotate*
sudo rc-service crond status echo '/var/log/MY_SERVICE_NAME/log.txt {
daily
missingok
rotate 7
compress
delaycompress
notifempty
copytruncate
}' | sudo tee /etc/logrotate.d/MY_SERVICE_NAME sudo logrotate /etc/logrotate.d/MY_SERVICE_NAME --debug |
Alpine 19 is a little bit different. Not sure how yet, but here's a working config: #!/sbin/openrc-run
name="x5c"
description="x5c API service"
command="/home/app/srv/x5c/x5c-server"
command_args="--port 3080"
command_user="app:app"
supervisor="supervise-daemon"
output_log="/var/log/x5c"
error_log="/var/log/x5c"
depend() {
need net
}
start_pre() {
checkpath --directory --owner root /var/log/
checkpath --file --owner ${command_user} ${output_log} ${error_log}
}
start() {
ebegin "Starting ${name}"
supervise-daemon ${name} --start \
--stdout ${output_log} \
--stderr ${error_log} \
--pidfile /run/${RC_SVCNAME}.pid \
--respawn-delay 5 \
--respawn-max 10 \
-- \
${command} \
${command_args} \
eend $?
}
stop() {
ebegin "Stopping ${name}"
supervise-daemon ${name} --stop \
--pidfile /run/${RC_SVCNAME}.pid
eend $?
} |
Notes
Basic
: https://wiki.alpinelinux.org/wiki/Writing_Init_Scripts#Basic_examplecheckpath
: https://manpages.debian.org/testing/openrc/openrc-run.8.en.html--env
: https://manpages.org/supervise-daemon/8Update
See the
logrotate
section below, which has not yet been integrated into this script.Proof of Concept
Install
Usage
# serviceman-add <app-name> <--> <command> [args] serviceman-add my-app -- node ./server.js
Implementation
serviceman-add
:_serviceman-add-openrc-tmpl
:The text was updated successfully, but these errors were encountered: