SOURCES: powersoftplus.init - use functions - force-reload is not ...
qboosh
qboosh at pld-linux.org
Fri Feb 8 20:23:06 CET 2008
Author: qboosh Date: Fri Feb 8 19:23:06 2008 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- use functions
- force-reload is not supposed to start service if not running
- added try-restart action
---- Files affected:
SOURCES:
powersoftplus.init (1.5 -> 1.6)
---- Diffs:
================================================================
Index: SOURCES/powersoftplus.init
diff -u SOURCES/powersoftplus.init:1.5 SOURCES/powersoftplus.init:1.6
--- SOURCES/powersoftplus.init:1.5 Thu Dec 8 02:02:49 2005
+++ SOURCES/powersoftplus.init Fri Feb 8 20:23:01 2008
@@ -16,11 +16,7 @@
# Get service config - may override defaults
[ -f /etc/sysconfig/powersoftplus ] && . /etc/sysconfig/powersoftplus
-RETVAL=0
-# See how we were called.
-case "$1" in
- start)
- # Check if the service is already running?
+start() {
if [ ! -f /var/lock/subsys/powersoftplus ]; then
rm -f /var/run/power.pid
msg_starting powersoftplus
@@ -30,10 +26,10 @@
else
msg_already_running powersoftplus
fi
- ;;
- stop)
+}
+
+stop() {
if [ -f /var/lock/subsys/powersoftplus ]; then
- # Stop daemons.
msg_stopping powersoftplus
killproc powersoftplus
ipcrm -S 0x78010096 > /dev/null 2>&1
@@ -41,11 +37,36 @@
else
msg_not_running powersoftplus
fi
+}
+
+condrestart() {
+ if [ -f /var/lock/subsys/powersoftplus ]; then
+ stop
+ start
+ else
+ msg_not_running powersoftplus
+ RETVAL=$1
+ fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+ start)
+ start
;;
- restart|force-reload)
- $0 stop
- $0 start
- exit $?
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ try-restart)
+ condrestart 0
+ ;;
+ force-reload)
+ condrestart 7
;;
status)
status powersoftplus
@@ -53,7 +74,7 @@
exit $?
;;
*)
- msg_usage "$0 {start|stop|restart|force-reload|status}"
+ msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
exit 3
esac
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/powersoftplus.init?r1=1.5&r2=1.6&f=u
More information about the pld-cvs-commit
mailing list