Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > 2d485c2c9d7ec67931fa3cbfb3b2511c > files > 8

at-3.1.10.1-2.2mdv2009.0.src.rpm

#!/bin/bash
#
#	/etc/rc.d/init.d/atd
#
# Starts the at daemon
#
# 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
#
### BEGIN INIT INFO
# Provides: atd at
# Default-Start: 3 4 5
# Short-Description: Starts the at daemon
# 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.
### END INIT INFO

# Source function library.
. /etc/init.d/functions

test -x /usr/sbin/atd || exit 0

RETVAL=0

#
#	See how we were called.
#

prog="atd"

start() {
	# Check if atd is already running
	if [ ! -f /var/lock/subsys/atd ]; then
	    echo -n $"Starting $prog: "
	    daemon /usr/sbin/atd
	    RETVAL=$?
	    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/atd
	    echo
	fi
	return $RETVAL
}

stop() {
	echo -n $"Stopping $prog: "
	killproc /usr/sbin/atd
	RETVAL=$?
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/atd
	echo
        return $RETVAL
}


restart() {
	stop
	start
}	

reload() {
	restart
}	

status_at() {
 	status /usr/sbin/atd
}

case "$1" in
start)
	start
	;;
stop)
	stop
	;;
reload|restart)
	restart
	;;
condrestart)
	if [ -f /var/lock/subsys/atd ]; then
	    restart
	fi
	;;
status)
	status_at
	;;
*)
	echo $"Usage: $0 {start|stop|restart|condrestart|status}"
	exit 1
esac

exit $?
exit $RETVAL