PKGBUILDs/core/syslog-ng/syslog-ng.rc
2009-09-26 12:10:12 -05:00

40 lines
803 B
Bash

#!/bin/bash
. /opt/etc/rc.conf
. /opt/etc/rc.d/functions
PID=`pidof -o %PPID /opt/sbin/syslog-ng`
case "$1" in
start)
stat_busy "Starting Syslog-NG"
[ -z "$PID" ] && /opt/sbin/syslog-ng
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon syslog-ng
stat_done
fi
;;
stop)
stat_busy "Stopping Syslog-NG"
[ ! -z "$PID" ] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm -f /opt/var/run/syslog-ng.pid
# Removing stale syslog-ng.persist file. It's new location, as of 2.0.6-1, is /opt/var/lib/syslog-ng/
rm -f /opt/var/syslog-ng.persist
rm_daemon syslog-ng
stat_done
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0