SOURCES: syslog-ng.init - use functions - added flush-logs target

glen glen at pld-linux.org
Tue Sep 26 20:44:44 CEST 2006


Author: glen                         Date: Tue Sep 26 18:44:44 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- use functions
- added flush-logs target

---- Files affected:
SOURCES:
   syslog-ng.init (1.15 -> 1.16) 

---- Diffs:

================================================================
Index: SOURCES/syslog-ng.init
diff -u SOURCES/syslog-ng.init:1.15 SOURCES/syslog-ng.init:1.16
--- SOURCES/syslog-ng.init:1.15	Tue May 30 13:40:40 2006
+++ SOURCES/syslog-ng.init	Tue Sep 26 20:44:39 2006
@@ -25,10 +25,7 @@
 	syslog-ng $OPTIONS -s
 }
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
 	# Check if the service is already running?
 	if [ ! -f /var/lock/subsys/syslog-ng ]; then
 		msg_starting "syslog-ng"
@@ -38,8 +35,9 @@
 	else
 		msg_already_running "syslog-ng"
 	fi
-	;;
-  stop)
+}
+
+stop() {
 	if [ -f /var/lock/subsys/syslog-ng ]; then
 		msg_stopping "syslog-ng"
 		killproc syslog-ng
@@ -47,18 +45,23 @@
 	else
 		msg_not_running syslog-ng
 	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+  	start
 	;;
-  status)
-	status syslog-ng
-	exit $?
+  stop)
+  	stop
 	;;
   restart)
 	configtest
 	RETVAL=$?
 	if [ $RETVAL -eq 0 ]; then
-		$0 stop
-		$0 start
-		RETVAL=$?
+		stop
+		start
 	else
 		fail
 		echo >&2 "Configuration file syntax test failed."
@@ -84,6 +87,24 @@
 		msg_not_running syslog-ng
 		exit 7
 	fi
+	;;
+  flush-logs)
+	if [ -f /var/lock/subsys/syslog-ng ]; then
+		msg_reloading "syslog-ng"
+		configtest
+		RETVAL=$?
+		if [ $RETVAL -eq 0 ]; then
+			killproc syslog-ng -HUP
+			RETVAL=$?
+		else
+			fail
+			echo >&2 "Configuration file syntax test failed."
+		fi
+	fi
+	;;
+  status)
+	status syslog-ng
+	exit $?
 	;;
   *)
 	msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/syslog-ng.init?r1=1.15&r2=1.16&f=u



More information about the pld-cvs-commit mailing list