- 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

158
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
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
lockfile=/var/lock/subsys/$prog
[ -f /etc/sysconfig/atd ] || exit 6
start() { start() {
# Check if atd is already running [ -x $exec ] || exit 5
echo -n $"Starting $prog: " [ -f $config ] || exit 6
daemon $ATD $OPTS && success || failure echo -n $"Starting $prog: "
RETVAL=$? daemon $exec $OPTS && success || failure
[ "$RETVAL" = 0 ] && touch $LOCK_FILE retval=$?
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() {
stop
start
}
reload() {
restart
}
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
} }
restart() {
stop
start
}
reload() {
echo -n $"Reloading $prog: "
if [ -n "`pidfileofproc $ATD`" ]; then
killproc $ATD -HUP
else
failure $"Reloading $prog"
fi
RETVAL=$?
echo
}
case "$1" in case "$1" in
start) start)
start rh_status_q && exit 0
;; $1
stop) ;;
stop stop)
;; rh_status_q || exit 0
restart) $1
stop ;;
start restart)
;; $1
reload) ;;
reload reload)
;; rh_status_q || exit 7
condrestart) $1
if [ -f $LOCK_FILE ]; then ;;
if [ "$RETVAL" = 0 ]; then force-reload)
stop force_reload
sleep 3 ;;
start status)
fi rh_status
fi ;;
;; condrestart|try-restart)
status) rh_status_q || exit 0
status $ATD restart
;; ;;
*) *)
echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}" echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
RETVAL=3 exit 2
esac esac
exit $RETVAL exit $?