home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ee.lbl.gov
/
2014.05.ftp.ee.lbl.gov.tar
/
ftp.ee.lbl.gov
/
acld-1.11.tar.gz
/
acld-1.11.tar
/
acld-1.11
/
acld.sh.in
< prev
next >
Wrap
Text File
|
2011-05-25
|
2KB
|
93 lines
#!/bin/sh
# @(#) $Id: acld.sh.in 741 2011-05-25 20:04:40Z leres $ (LBL)
#
# PROVIDE: acld
#
. /etc/rc.subr
name="acld"
rcvar=`set_rcvar`
command="acld"
start_cmd="acld_start"
stop_status="acld_status"
acldir="/var/log/acld"
PATH="@PREFIX@/libexec:@PREFIX@/sbin:${PATH}"
export PATH
pidfile="/var/run/acld/${name}.pid"
acld_start() {
if [ -r ${pidfile} ]; then
pid="`cat ${pidfile}`"
if [ -n "${pidfile}" ]; then
kill -0 ${pid} 2> /dev/null
if [ $? -eq 0 ]; then
echo "${prog}: acld already running (pid ${pid})" 1>&2
exit 1
fi
fi
fi
echo "Starting ${name}."
cd ${acldir} || exit 1
sub="acld on `hostname` restarted"
(while : ; do
myuser="${acld_user:-zeek}"
rm -f ${pidfile}
(umask 022 ; touch ${pidfile})
chown ${myuser}:wheel ${pidfile}
debuglog="/var/log/acld/acld.log"
if [ ! -f "${debuglog}" ]; then
(umask 027 ; touch ${debuglog})
fi
chown ${myuser}:wheel ${debuglog}
su -fm ${myuser} <<EOF
acld -f -d -o ${debuglog}
EOF
xstatus=$?
if [ "${xstatus}" -gt 128 ]; then
sig="`expr ${xstatus} - 128`"
if [ "${sig}" -eq 15 ]; then
# SIGTERM -- just exit
exit 0
fi
msg="[Exited via signal ${sig}]"
else
msg="[After exiting with status ${xstatus}]"
fi
sleep 10
# Do this every time in case it changes
. /etc/rc.conf
notify="${acld_watcher:-root}"
(echo "To: ${notify}"
echo "Subject: ${sub}"
echo ""
echo "${msg}"
echo ""
tail -33 ${f}) | sendmail -bm -froot -t
done &) > /dev/null 2>&1
}
acld_status() {
f="@PREFIX@/libexec/acl.exp"
if [ ! -r ${f} ]; then
echo "$0: Can't find ${f}" 1>&2
exit 1
fi
${f} state
}
load_rc_config ${name}
run_rc_command "$1"