PKGBUILDs/core/syslog-ng/syslog-ng.rc

40 lines
803 B
Plaintext
Raw Normal View History

2009-09-26 14:35:50 +00:00
#!/bin/bash
2009-09-26 17:10:12 +00:00
. /opt/etc/rc.conf
. /opt/etc/rc.d/functions
2009-09-26 14:35:50 +00:00
2009-09-26 17:10:12 +00:00
PID=`pidof -o %PPID /opt/sbin/syslog-ng`
2009-09-26 14:35:50 +00:00
case "$1" in
start)
stat_busy "Starting Syslog-NG"
2009-09-26 17:10:12 +00:00
[ -z "$PID" ] && /opt/sbin/syslog-ng
2009-09-26 14:35:50 +00:00
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
2009-09-26 17:10:12 +00:00
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
2009-09-26 14:35:50 +00:00
rm_daemon syslog-ng
stat_done
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0