]> git.pld-linux.org Git - packages/at.git/blobdiff - atd.init
- dropped pre-cvs changelog
[packages/at.git] / atd.init
index 5bd1f5ae016dc6b3d7e17c89ca0837d57fad129e..6a300d4da42e97e69536eac601875b4f16c24ee9 100644 (file)
--- a/atd.init
+++ b/atd.init
@@ -1,46 +1,57 @@
 #!/bin/sh
 #
-#      /etc/rc.d/init.d/atd
+# atd          Runs commands scheduled by the at command
 #
-# Starts the at daemon
+# chkconfig:   345 40 60
 #
-# chkconfig: 345 40 60
-# description: Runs commands scheduled by the at command at the time \
-#    specified when at was run, and runs batch commands when the load \
-#    average is low enough.
-# processname: atd
+# description: Runs commands scheduled by the at command at the time \
+#              specified when at was run, and runs batch commands when \
+#              the load average is low enough.
+#
+# processname: atd
+
 
-# Source function library.
+# Source function library
 . /etc/rc.d/init.d/functions
 
-# Try get sysconfig ...
-if [ -f /etc/sysconfig/at ]; then
-    . /etc/sysconfig/at
-fi    
+# Get service config
+[ -f /etc/sysconfig/atd ] && . /etc/sysconfig/atd
 
-#      See how we were called.
-#
+RETVAL=0
+# See how we were called.
 case "$1" in
   start)
-       show Starting at daemon
-        daemon atd
-        touch /var/lock/subsys/atd
+       # Check if the service is already running?
+       if [ ! -f /var/lock/subsys/atd ]; then
+               msg_starting at
+               daemon atd
+               RETVAL=$?
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/atd
+       else
+               msg_already_running atd
+       fi
        ;;
   stop)
-       show Stopping at daemon
-       killproc atd
-       rm -f /var/lock/subsys/atd
+       if [ -f /var/lock/subsys/atd ]; then
+               msg_stopping at
+               killproc atd
+               rm -f /var/lock/subsys/atd
+       else
+               msg_not_running atd
+       fi
        ;;
-  reload|restart)
+  force-reload|restart)
        $0 stop
        $0 start
+       exit $?
        ;;
   status)
        status atd
+       exit $?
        ;;
   *)
-       echo "Usage: $0 {start|stop|restart|reload|status}"
-       exit 1
+       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       exit 3
 esac
 
-exit 0
+exit $RETVAL
This page took 0.129894 seconds and 4 git commands to generate.