- update init script according to SysVInitScript

This commit is contained in:
Marcela Mašláňová 2008-10-24 13:14:05 +00:00
parent 04cf46f800
commit b51bd77026
2 changed files with 91 additions and 72 deletions

View File

@ -6,7 +6,7 @@
Summary: Job spooling tools Summary: Job spooling tools
Name: at Name: at
Version: 3.1.10 Version: 3.1.10
Release: 25%{?dist} Release: 26%{?dist}
License: GPLv2+ License: GPLv2+
Group: System Environment/Daemons Group: System Environment/Daemons
URL: http://ftp.debian.org/debian/pool/main/a/at URL: http://ftp.debian.org/debian/pool/main/a/at
@ -187,6 +187,9 @@ fi
%attr(4755,root,root) %{_bindir}/at %attr(4755,root,root) %{_bindir}/at
%changelog %changelog
* Fri Oct 24 2008 Marcela Mašláňová <mmaslano@redhat.com> - 3.1.10-26
- update init script according to SysVInitScript
* Tue Sep 16 2008 Marcela Maslanova <mmaslano@redhat.com> - 3.1.10-25 * Tue Sep 16 2008 Marcela Maslanova <mmaslano@redhat.com> - 3.1.10-25
- thanks dwalsh for selinux patch, which fix #460873 - thanks dwalsh for selinux patch, which fix #460873

122
atd.init
View File

@ -1,95 +1,111 @@
#!/bin/bash #!/bin/sh
# #
# /etc/rc.d/init.d/atd # atd Starts/stop the "at" daemon
#
# Starts the "at" daemon
# #
# chkconfig: 345 95 5 # chkconfig: 345 95 5
# description: Runs commands scheduled by the "at" command at the time \ # description: Runs commands scheduled by the "at" command at the time \
# specified when "at" was run, and runs batch commands when the load \ # specified when "at" was run, and runs batch commands when the load \
# average is low enough. # average is low enough.
# processname: atd
### BEGIN INIT INFO
# Provides: atd at batch
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 345
# Default-Stop: 95
# Short-Description: Starts/stop 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. # Source function library.
. /etc/init.d/functions . /etc/rc.d/init.d/functions
# pull in sysconfig settings exec=/usr/sbin/atd
[ -f /etc/sysconfig/atd ] && . /etc/sysconfig/atd
RETVAL=0
prog="atd" prog="atd"
ATD=/usr/sbin/atd config=/etc/sysconfig/atd
LOCK_FILE=/var/lock/subsys/atd
[ -f /etc/sysconfig/atd ] || exit 6 [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
lockfile=/var/lock/subsys/$prog
start() { start() {
# Check if atd is already running [ -x $exec ] || exit 5
[ -f $config ] || exit 6
echo -n $"Starting $prog: " echo -n $"Starting $prog: "
daemon $ATD $OPTS && success || failure daemon $exec $OPTS && success || failure
RETVAL=$? retval=$?
[ "$RETVAL" = 0 ] && touch $LOCK_FILE
echo echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
} }
stop() { stop() {
echo -n $"Stopping $prog: " echo -n $"Stopping $prog: "
if [ -n "`pidfileofproc $ATD`" ] ; then if [ -n "`pidfileofproc $exec`" ] ; then
killproc $ATD killproc $exec
RETVAL=3 RETVAL=3
else else
failure $"Stopping $prog" failure $"Stopping $prog"
fi fi
RETVAL=$? retval=$?
[ "$RETVAL" = 0 ] && rm -f $LOCK_FILE
echo echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
} }
restart() { restart() {
stop stop
start start
} }
reload() { reload() {
echo -n $"Reloading $prog: " restart
if [ -n "`pidfileofproc $ATD`" ]; then
killproc $ATD -HUP
else
failure $"Reloading $prog"
fi
RETVAL=$?
echo
} }
force_reload() {
restart
}
rh_status() {
# run checks to determine if the service is running or use generic status
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in case "$1" in
start) start)
start rh_status_q && exit 0
$1
;; ;;
stop) stop)
stop rh_status_q || exit 0
$1
;; ;;
restart) restart)
stop $1
start
;; ;;
reload) reload)
reload rh_status_q || exit 7
$1
;; ;;
condrestart) force-reload)
if [ -f $LOCK_FILE ]; then force_reload
if [ "$RETVAL" = 0 ]; then
stop
sleep 3
start
fi
fi
;; ;;
status) status)
status $ATD rh_status
;; ;;
*) condrestart|try-restart)
echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}" rh_status_q || exit 0
RETVAL=3 restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac esac
exit $RETVAL exit $?