SOURCES: portmap.init - use functions
glen
glen at pld-linux.org
Mon Oct 2 22:25:03 CEST 2006
Author: glen Date: Mon Oct 2 20:25:03 2006 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- use functions
---- Files affected:
SOURCES:
portmap.init (1.18 -> 1.19)
---- Diffs:
================================================================
Index: SOURCES/portmap.init
diff -u SOURCES/portmap.init:1.18 SOURCES/portmap.init:1.19
--- SOURCES/portmap.init:1.18 Sun Mar 12 13:49:02 2006
+++ SOURCES/portmap.init Mon Oct 2 22:24:58 2006
@@ -30,10 +30,7 @@
exit 0
fi
-RETVAL=0
-# See how we were called.
-case "$1" in
- start)
+start() {
# Check if the service is already running?
if [ ! -f /var/lock/subsys/portmap ]; then
PORTMAP_OPTIONS=
@@ -46,8 +43,9 @@
else
msg_already_running portmap
fi
- ;;
- stop)
+}
+
+stop() {
if [ -f /var/lock/subsys/portmap ]; then
msg_stopping portmap
killproc portmap
@@ -55,33 +53,49 @@
else
msg_not_running portmap
fi
- ;;
- status)
- status portmap
- exit $?
- ;;
- dump)
+}
+
+dump() {
PORTMAP_OPTIONS=
[ -z "${PORTMAP_IP}" ] || PORTMAP_OPTIONS="-i ${PORTMAP_IP}"
pmap_dump ${PORTMAP_OPTIONS} >/var/lib/misc/portmap.dump
- exit $?
- ;;
- restore)
+ RETVAL=$?
+}
+
+restore() {
if [ -f /var/lib/misc/portmap.dump ] ; then
pmap_set </var/lib/misc/portmap.dump
- exit $?
+ RETVAL=$?
fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ dump)
+ dump
+ ;;
+ restore)
+ restore
;;
cleanup)
- $0 stop
- $0 start
- exit $?
+ stop
+ start
;;
restart|force-reload)
- $0 dump
- $0 stop
- $0 start
- $0 restore
+ dump
+ stop
+ start
+ restore
+ ;;
+ status)
+ status portmap
exit $?
;;
*)
================================================================
---- CVS-web:
http://cvs.pld-linux.org/SOURCES/portmap.init?r1=1.18&r2=1.19&f=u
More information about the pld-cvs-commit
mailing list