Skip to content

Commit

Permalink
Merge pull request #1920 from thesamesam/openrc-init
Browse files Browse the repository at this point in the history
distrib: refine OpenRC init scripts
  • Loading branch information
slingamn authored Feb 20, 2022
2 parents 1e7775f + 7c766b2 commit 87d9add
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions distrib/openrc/ergo.confd
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# /etc/conf.d/ergo: config file for /etc/init.d/ergo
ERGO_CONFIGFILE="/etc/ergo/ircd.yaml"
ERGO_USERNAME="ergo"
21 changes: 17 additions & 4 deletions distrib/openrc/ergo.initd
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
#!/sbin/openrc-run
name=${RC_SVCNAME}
description="ergo IRC daemon"

command=/usr/bin/ergo
command_args="run --conf ${ERGO_CONFIGFILE:-"/etc/ergo/ircd.yaml"}"
command_args="run --conf ${ERGO_CONFIGFILE:-'/etc/ergo/ircd.yaml'}"
command_user=${ERGO_USERNAME:-ergo}
command_background=true

pidfile=/var/run/${RC_SVCNAME}.pid

output_log="/var/log/${RC_SVCNAME}.out"
error_log="/var/log/${RC_SVCNAME}.err"
# --wait: to wait 1 second after launching to see if it survived startup
start_stop_daemon_args="--wait 1000"

extra_started_commands="reload"
pidfile=/var/run/ergo.pid
name="ergo"
description="ergo IRC daemon"

depend() {
use dns
provide ircd
}

start_pre() {
checkpath --owner ${command_user}:${command_user} --mode 0640 --file /var/log/${RC_SVCNAME}.out /var/log/${RC_SVCNAME}.err
}

reload() {
ebegin "Reloading ${RC_SVCNAME}"
start-stop-daemon --signal HUP --pidfile "${pidfile}"
Expand Down

0 comments on commit 87d9add

Please sign in to comment.