1 #!/bin/bash 2 # 3 # /etc/init.d/atd 4 # 5 # Starts the at daemon 6 # 7 # chkconfig: 345 95 5 8 # description: Runs commands scheduled by the at command at the time \ 9 # specified when at was run, and runs batch commands when the load \ 10 # average is low enough. 11 # processname: atd 12 13 # Source function library. 14 . /etc/init.d/functions 15 16 test -x /usr/sbin/atd || exit 0 17 18 RETVAL=0 19 20 # 21 # See how we were called. 22 # 23 24 prog="atd" 25 26 start() { 27 # Check if atd is already running 28 if [ ! -f /var/lock/subsys/atd ]; then 29 echo -n $"Starting $prog: " 30 daemon /usr/sbin/atd 31 RETVAL=$? 32 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/atd 33 echo 34 fi 35 return $RETVAL 36 } 37 38 stop() { 39 echo -n $"Stopping $prog: " 40 killproc /usr/sbin/atd 41 RETVAL=$? 42 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/atd 43 echo 44 return $RETVAL 45 } 46 47 48 restart() { 49 stop 50 start 51 } 52 53 reload() { 54 restart 55 } 56 57 status_at() { 58 status /usr/sbin/atd 59 } 60 61 case "$1" in 62 start) 63 start 64 ;; 65 stop) 66 stop 67 ;; 68 reload|restart) 69 restart 70 ;; 71 condrestart) 72 if [ -f /var/lock/subsys/atd ]; then 73 restart 74 fi 75 ;; 76 status) 77 status_at 78 ;; 79 *) 80 echo $"Usage: $0 {start|stop|restart|condrestart|status}" 81 exit 1 82 esac 83 84 exit $? 85 exit $RETVAL