Changeset View
Changeset View
Standalone View
Standalone View
head/sysutils/zrepl/files/zrepl.in
Show All 34 Lines | |||||
: ${zrepl_enable:="NO"} | : ${zrepl_enable:="NO"} | ||||
: ${zrepl_config:="%%PREFIX%%/etc/zrepl/zrepl.yml"} | : ${zrepl_config:="%%PREFIX%%/etc/zrepl/zrepl.yml"} | ||||
: ${zrepl_user:="root"} | : ${zrepl_user:="root"} | ||||
: ${zrepl_group:="wheel"} | : ${zrepl_group:="wheel"} | ||||
: ${zrepl_flags:=""} | : ${zrepl_flags:=""} | ||||
: ${zrepl_facility:="local0"} | : ${zrepl_facility:="local0"} | ||||
: ${zrepl_priority:="alert"} | : ${zrepl_priority:="alert"} | ||||
: ${zrepl_options:="${zrepl_flags} --config ${zrepl_config} daemon"} | : ${zrepl_options:="${zrepl_flags} --config ${zrepl_config}"} | ||||
pidfile="/var/run/zrepl/daemon.pid" | pidfile="/var/run/zrepl/daemon.pid" | ||||
command="/usr/sbin/daemon" | command="/usr/sbin/daemon" | ||||
procname="%%PREFIX%%/bin/zrepl" | procname="%%PREFIX%%/bin/zrepl" | ||||
command_args="-p ${pidfile} %%DAEMON_LOGGING%% ${procname} ${zrepl_options}" | command_args="-p ${pidfile} %%DAEMON_LOGGING%% ${procname} ${zrepl_options} daemon" | ||||
start_precmd=zrepl_precmd | start_precmd="zrepl_precmd" | ||||
stop_postcmd=zrepl_postcmd | stop_postcmd="zrepl_postcmd" | ||||
restart_precmd="zrepl_checkconfig" | |||||
configtest_cmd="zrepl_checkconfig" | |||||
extra_commands="configtest" | |||||
zrepl_precmd() | zrepl_precmd() | ||||
{ | { | ||||
if [ ! -d "/var/run/zrepl/stdinserver" ]; then | if [ ! -d "/var/run/zrepl/stdinserver" ]; then | ||||
install -d -g ${zrepl_group} -o ${zrepl_user} -m 0700 -- "/var/run/zrepl"; | install -d -g ${zrepl_group} -o ${zrepl_user} -m 0700 -- "/var/run/zrepl"; | ||||
install -d -g ${zrepl_group} -o ${zrepl_user} -m 0700 -- "/var/run/zrepl/stdinserver"; | install -d -g ${zrepl_group} -o ${zrepl_user} -m 0700 -- "/var/run/zrepl/stdinserver"; | ||||
fi | fi | ||||
if [ ! -e "${pidfile}" ]; then | if [ ! -e "${pidfile}" ]; then | ||||
install -g ${zrepl_group} -o ${zrepl_user} -- /dev/null "${pidfile}"; | install -g ${zrepl_group} -o ${zrepl_user} -- /dev/null "${pidfile}"; | ||||
fi | fi | ||||
zrepl_checkconfig | |||||
} | } | ||||
zrepl_postcmd() | zrepl_postcmd() | ||||
{ | { | ||||
rm -f -- "${pidfile}" | rm -f -- "${pidfile}" | ||||
} | |||||
zrepl_checkconfig() | |||||
{ | |||||
echo "Performing sanity check on zrepl configuration:" | |||||
eval ${procname} ${zrepl_options} configcheck | |||||
} | } | ||||
run_rc_command "$1" | run_rc_command "$1" |