]> git.pld-linux.org Git - packages/am-utils.git/blobdiff - am-utils.init
- dropped pre-cvs changelog
[packages/am-utils.git] / am-utils.init
index f2f59db5593d3403c04a4ac1143398e5ee3fa499..2868beb620c28b1f13b50644b42d1b542eedf9f3 100644 (file)
@@ -1,48 +1,66 @@
 #!/bin/sh
 #
-# Version: 1.2
-#
-# chkconfig: 345 72 28
-# description: Runs the automount daemon that mounts devices and NFS hosts \
-#             on demand.
-# processname: amd
-# config: /etc/amd.conf
-#
+# chkconfig:   345 72 28
+# description: Runs the automount daemon that mounts devices and NFS hosts \
+#              on demand.
+# processname: amd
+# config:      /etc/amd.conf
 
 # Source function library.
 . /etc/rc.d/init.d/functions
 
+# Demon specified configuration.
 . /etc/sysconfig/amd
 
+if [ "$1" != "stop" ]; then
+       check_portmapper || { nls "Error: portmap isn't running" && exit 0; }
+fi
+
+RETVAL=0
 # See how we were called.
 case "$1" in
   start)
-       echo -n "Starting amd: "
-       touch /var/lock/subsys/amd
-       daemon /usr/sbin/amd -a $ADIR -l syslog $AMDOPTS -c 1000 $MOUNTPTS
-       echo
-       
+       # Check if the service is already running?
+       if [ ! -f /var/lock/subsys/amd ]; then
+               msg_starting amd
+               daemon /usr/sbin/amd -a $ADIR -l syslog $AMDOPTS -c 1000 $MOUNTPTS
+               RETVAL=$?
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/amd
+       else
+               msg_already_running Amavisd
+       fi
        ;;
   stop)
-       echo -n "Shutting down amd: "
-       killproc amd
-       rm -f /var/lock/subsys/amd
-       echo
+       if [ -f /var/lock/subsys/amd ]; then
+               msg_stopping amd
+               killproc amd
+               rm -f /var/lock/subsys/amd
+       else
+               msg_not_running Amavisd
+       fi
        ;;
   status)
        status amd
+       exit $?
        ;;
   restart)
        $0 stop
        $0 start
+       exit $?
        ;;
-  reload)
-       killall -HUP amd
+  reload|force-reload)
+       if [ -f /var/lock/subsys/amd ]; then
+               msg_reloading amd
+               killproc -HUP amd
+               RETVAL=$?
+       else
+               msg_not_running Amavisd >&2
+               RETVAL=7
+       fi
        ;;
   *)
-       echo "Usage: amd {start|stop|status|restart|reload}"
-       exit 1
+       msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+       exit 3
 esac
 
-exit 0
-
+exit $RETVAL
This page took 0.077692 seconds and 4 git commands to generate.