summaryrefslogtreecommitdiff
path: root/system/syslog-ng/rc.syslog-ng
diff options
context:
space:
mode:
authormario <mario@slackverse.org>2010-07-07 03:54:48 -0500
committerRobby Workman <rworkman@slackbuilds.org>2010-07-08 00:13:26 -0500
commit63bcc5c4ef689dc81024391b0ceaf39de0707b21 (patch)
tree55b0bd3a882ecf46561761291b04a82ff23879e0 /system/syslog-ng/rc.syslog-ng
parentcfbd3757c04cfeabbdebc158663e45884a49cd7d (diff)
downloadslackbuilds-63bcc5c4ef689dc81024391b0ceaf39de0707b21.tar.gz
system/syslog-ng: Added (syslogd replacment)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'system/syslog-ng/rc.syslog-ng')
-rw-r--r--system/syslog-ng/rc.syslog-ng53
1 files changed, 53 insertions, 0 deletions
diff --git a/system/syslog-ng/rc.syslog-ng b/system/syslog-ng/rc.syslog-ng
new file mode 100644
index 0000000000..1d5511b648
--- /dev/null
+++ b/system/syslog-ng/rc.syslog-ng
@@ -0,0 +1,53 @@
+#!/bin/sh
+# Start/stop/restart the syslog-ng daemon.
+# Specially tailored to emulate Slackware's stock syslogd/klogd.
+#
+# Written by mario <mario@slackverse.org>.
+
+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
+
+ # Create a fake syslogd.pid file for rc.M
+ if [ -f /var/run/syslog-ng.pid ] && kill -0 $(cat /var/run/syslog-ng.pid) 2> /dev/null; then
+ cp -a /var/run/syslog-ng.pid /var/run/syslogd.pid
+ 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
+ # Remove a fake pid file
+ rm -f /var/run/syslogd.pid
+ 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
+