1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-23 11:15:13 +03:00
aports/community/hitch/hitch.initd
Jakub Jirutka 4963e78fd5 community/hitch: fix init script
I forgot that $name is not defined by default.
2021-01-08 14:05:53 +01:00

59 lines
1.1 KiB
Text

#!/sbin/openrc-run
extra_commands="checkconfig"
extra_started_commands="reload"
description="A scalable TLS proxy"
description_checkconfig="Verify configuration file"
description_reload="Reload configuration"
: ${name:=$RC_SVCNAME}
# $HITCH_CONFIGFILE is here for backward compatibility only
: ${cfgfile:=${HITCH_CONFIGFILE:-"/etc/hitch/${RC_SVCNAME#hitch.}.conf"}}
command="/usr/sbin/hitch"
command_args="--config=$cfgfile"
command_background=yes
pidfile="/run/$RC_SVCNAME.pid"
required_files="$cfgfile"
depend() {
need net
before logger
}
checkconfig() {
ebegin "Checking $name configuration"
hitch -t --config=$cfgfile >/dev/null 2>&1
ret=$?
if [ $ret -ne 0 ]; then
eerror "$RC_SVCNAME has detected an error:"
hitch -t --config=$cfgfile
fi
eend $ret
}
start_pre() {
checkconfig || return 1
}
stop_pre() {
if [ "$RC_CMD" = "restart" ]; then
checkconfig || return 1
fi
}
reload() {
checkconfig || return 1
ebegin "Reloading $name"
if [ "$supervisor" ]; then
$supervisor "$RC_SVCNAME" --signal HUP
else
start-stop-daemon --pidfile "$pidfile" --signal HUP
fi
eend $?
}