Changeset View
Changeset View
Standalone View
Standalone View
head/sysutils/sec/files/sec.in
Show All 28 Lines | |||||
name="sec" | name="sec" | ||||
rcvar=sec_enable | rcvar=sec_enable | ||||
command="%%PREFIX%%/bin/sec" | command="%%PREFIX%%/bin/sec" | ||||
command_args="-detach" | command_args="-detach" | ||||
command_interpreter="%%PERL%%" | command_interpreter="%%PERL%%" | ||||
extra_commands="reload" | extra_commands="reload" | ||||
pidfile="/var/run/sec.pid" | pidfile="/var/run/sec/sec.pid" | ||||
start_precmd="sec_checkconfig" | start_precmd="sec_precmd" | ||||
reload_precmd="sec_checkconfig" | reload_precmd="sec_checkconfig" | ||||
restart_precmd="sec_checkconfig" | restart_precmd="sec_checkconfig" | ||||
sig_reload=HUP | sig_reload=HUP | ||||
load_rc_config "${name}" | load_rc_config "${name}" | ||||
[ -z "${sec_enable}" ] && sec_enable="NO" | [ -z "${sec_enable}" ] && sec_enable="NO" | ||||
[ -z "${sec_flags}" ] && sec_flags="-log=/var/log/sec.log" | [ -z "${sec_flags}" ] && sec_flags="-log=/var/log/sec.log" | ||||
[ -z "${sec_configfile}" ] && sec_configfile="%%PREFIX%%/etc/sec.conf" | [ -z "${sec_configfile}" ] && sec_configfile="%%PREFIX%%/etc/sec.conf" | ||||
sec_precmd() { | |||||
dn=`dirname ${pidfile}` | |||||
if [ ! -d ${dn} ]; then | |||||
mkdir -p ${dn} | |||||
if [ -n $sec_user ]; then | |||||
/usr/sbin/chown ${sec_user} ${dn} | |||||
fi | |||||
fi | |||||
sec_checkconfig | |||||
} | |||||
sec_checkconfig() { | sec_checkconfig() { | ||||
if [ -z $instance ] | if [ -z $instance ] | ||||
then | then | ||||
echo -n "Performing sanity check of sec configuration: " | echo -n "Performing sanity check of sec configuration: " | ||||
else | else | ||||
echo -n "Performing sanity check of sec_${instance} configuration: " | echo -n "Performing sanity check of sec_${instance} configuration: " | ||||
fi | fi | ||||
${command} -debug=1 -testonly -conf=${sec_configfile} 2>&1 >/dev/null | ${command} -debug=1 -testonly -conf=${sec_configfile} 2>&1 >/dev/null | ||||
Show All 13 Lines | |||||
# Are we handling multiple instances? | # Are we handling multiple instances? | ||||
if [ ! -z "${sec_instances}" ] | if [ ! -z "${sec_instances}" ] | ||||
then | then | ||||
for instance in $sec_instances | for instance in $sec_instances | ||||
do | do | ||||
# Iterate through all instances | # Iterate through all instances | ||||
name="sec_${instance}" | name="sec_${instance}" | ||||
pidfile="/var/run/sec_${instance}.pid" | pidfile="/var/run/sec/sec_${instance}.pid" | ||||
eval required_files=\$sec_${instance}_configfile | eval required_files=\$sec_${instance}_configfile | ||||
eval sec_${instance}_flags="\"-conf=\$sec_${instance}_configfile -pid=\$pidfile \$sec_${instance}_flags\"" | eval sec_${instance}_flags="\"-conf=\$sec_${instance}_configfile -pid=\$pidfile \$sec_${instance}_flags\"" | ||||
run_rc_command "$1" | run_rc_command "$1" | ||||
done | done | ||||
fi | fi |