2010-07-07 10:54:48 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2013-12-11 18:08:58 +01:00
|
|
|
# Start/stop/restart the syslog-ng daemon
|
|
|
|
# Drop-in replacement for a stock Slackware rc.syslog script
|
|
|
|
# Written by Mario Preksavec <mario@slackware.hr>
|
2010-07-07 10:54:48 +02:00
|
|
|
|
|
|
|
syslog_start() {
|
|
|
|
if [ -x /usr/sbin/syslog-ng ]; then
|
|
|
|
if [ -f /var/run/syslog-ng.pid ] && kill -0 $(cat /var/run/syslog-ng.pid) 2> /dev/null; then
|
|
|
|
echo "syslog-ng daemon already running!"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Starting syslog-ng daemon: /usr/sbin/syslog-ng"
|
|
|
|
/usr/sbin/syslog-ng -R /var/lib/syslog-ng/syslog-ng.persist
|
|
|
|
|
2013-12-11 18:08:58 +01:00
|
|
|
# Link syslogd.pid for compatibility with other rc scripts
|
2010-07-07 10:54:48 +02:00
|
|
|
if [ -f /var/run/syslog-ng.pid ] && kill -0 $(cat /var/run/syslog-ng.pid) 2> /dev/null; then
|
2013-12-11 18:08:58 +01:00
|
|
|
ln -sf /var/run/syslog-ng.pid /var/run/syslogd.pid
|
2010-07-07 10:54:48 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
syslog_stop() {
|
|
|
|
if [ -f /var/run/syslog-ng.pid ]; then
|
|
|
|
echo "Stopping syslog-ng daemon"
|
|
|
|
kill $(cat /var/run/syslog-ng.pid) 2> /dev/null && rm -f /var/run/syslog-ng.pid
|
2013-12-11 18:08:58 +01:00
|
|
|
# Unlink syslogd.pid
|
|
|
|
unlink /var/run/syslogd.pid
|
2010-07-07 10:54:48 +02:00
|
|
|
fi
|
|
|
|
killall syslog-ng 2> /dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
syslog_restart() {
|
|
|
|
syslog_stop
|
|
|
|
sleep 1
|
|
|
|
syslog_start
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
'start')
|
|
|
|
syslog_start
|
|
|
|
;;
|
|
|
|
'stop')
|
|
|
|
syslog_stop
|
|
|
|
;;
|
|
|
|
'restart')
|
|
|
|
syslog_restart
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "usage $0 start|stop|restart"
|
|
|
|
esac
|
|
|
|
|