packages: smartmontools/smartmontools.init - unify

glen glen at pld-linux.org
Thu Jan 13 00:04:44 CET 2011


Author: glen                         Date: Wed Jan 12 23:04:44 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- unify

---- Files affected:
packages/smartmontools:
   smartmontools.init (1.8 -> 1.9) 

---- Diffs:

================================================================
Index: packages/smartmontools/smartmontools.init
diff -u packages/smartmontools/smartmontools.init:1.8 packages/smartmontools/smartmontools.init:1.9
--- packages/smartmontools/smartmontools.init:1.8	Fri May  1 01:42:06 2009
+++ packages/smartmontools/smartmontools.init	Thu Jan 13 00:04:39 2011
@@ -8,7 +8,6 @@
 #
 # $Id$
 
-
 # Source function library
 . /etc/rc.d/init.d/functions
 
@@ -16,34 +15,49 @@
 [ -f /etc/sysconfig/smartd ] && . /etc/sysconfig/smartd
 
 start() {
-	if [ ! -f /var/lock/subsys/smartd ]; then
-		msg_starting smartd
-		daemon /usr/sbin/smartd </dev/null
-		RETVAL=$?
-		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/smartd
-	else
-		msg_already_running smartd
+	if [ -f /var/lock/subsys/smartd ]; then
+		msg_already_running "S.M.A.R.T. Daemon"
+		return
 	fi
+
+	msg_starting "S.M.A.R.T. Daemon"
+	daemon /usr/sbin/smartd </dev/null
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/smartd
 }
 
 stop() {
-	if [ -f /var/lock/subsys/smartd ]; then
-		msg_stopping smartd
-		killproc smartd
-		rm -f /var/lock/subsys/smartd
-	else
-		msg_not_running smartd
+	if [ ! -f /var/lock/subsys/smartd ]; then
+		msg_not_running "S.M.A.R.T. Daemon"
+		return
 	fi
+
+	msg_stopping "S.M.A.R.T. Daemon"
+	killproc smartd
+	rm -f /var/lock/subsys/smartd
 }
 
 condrestart() {
-	if [ -f /var/lock/subsys/smartd ]; then
-		stop
-		start
-	else
-		msg_not_running smartd
+	if [ ! -f /var/lock/subsys/smartd ]; then
+		msg_not_running "S.M.A.R.T. Daemon"
 		RETVAL=$1
+		return
 	fi
+
+	stop
+	start
+}
+
+reload() {
+	if [ ! -f /var/lock/subsys/smartd ]; then
+		msg_not_running "S.M.A.R.T. Daemon"
+		RETVAL=7
+		return
+	fi
+
+	msg_reloading "S.M.A.R.T. Daemon"
+	killproc smartd -HUP
+	RETVAL=$?
 }
 
 RETVAL=0
@@ -63,14 +77,7 @@
 	condrestart 0
 	;;
   reload|force-reload)
-	if [ -f /var/lock/subsys/smartd ]; then
-		msg_reloading smartd
-		killproc smartd -HUP
-		RETVAL=$?
-	else
-		msg_not_running smartd
-		exit 7
-	fi
+	reload
 	;;
   status)
 	status smartd
@@ -80,8 +87,4 @@
 	msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
 	exit 3
 esac
-
 exit $RETVAL
-
-# This must be last line !
-# vi:syntax=sh:tw=78:ts=8:sw=4
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/smartmontools/smartmontools.init?r1=1.8&r2=1.9&f=u



More information about the pld-cvs-commit mailing list