From 71eb17f1f033a058512a9808270fd258567e046f Mon Sep 17 00:00:00 2001 From: Marcela Mašláňová Date: Jul 12 2007 11:21:21 +0000 Subject: Add patch --- diff --git a/at-3.1.10-session.patch b/at-3.1.10-session.patch new file mode 100644 index 0000000..79414b8 --- /dev/null +++ b/at-3.1.10-session.patch @@ -0,0 +1,11 @@ +--- at-3.1.10/atd.c.old 2007-07-12 11:12:36.000000000 +0200 ++++ at-3.1.10/atd.c 2007-07-12 11:20:40.000000000 +0200 +@@ -303,6 +303,8 @@ + free(newname); + return; + } ++ (void) setsid(); //own session for process ++ + /* Let's see who we mail to. Hopefully, we can read it from + * the command file; if not, send it to the owner, or, failing that, + * to root. diff --git a/at.spec b/at.spec index 2d8c119..57ca93a 100644 --- a/at.spec +++ b/at.spec @@ -6,7 +6,7 @@ Summary: Job spooling tools Name: at Version: 3.1.10 -Release: 14%{?dist} +Release: 15%{?dist} License: GPL Group: System Environment/Daemons URL: http://ftp.debian.org/debian/pool/main/a/at @@ -26,6 +26,7 @@ Patch8: at-3.1.10-pam.patch Patch9: at-3.1.10-dont_fork.patch Patch10: at-3.1.10-perm.patch Patch11: at-3.1.10-opt_V.patch +Patch12: at-3.1.10-session.patch BuildRequires: fileutils chkconfig /etc/init.d BuildRequires: flex bison autoconf @@ -71,6 +72,7 @@ cp %{SOURCE1} . %patch9 -p1 -b .dont_fork %patch10 -p1 -b .perm %patch11 -p1 -b .opt_V +%patch12 -p1 -b .session %build # patch10 touches configure.in @@ -173,6 +175,11 @@ fi %attr(4755,root,root) %{_bindir}/at %changelog +* Tue Jul 11 2007 Marcela Maslanova - 3.1.10-15 +- rewrite init script +- add own session - setsid +- Resolves: rhbz#247091 + * Tue Jul 9 2007 Marcela Maslanova - 3.1.10-14 - feature: add configuration file - fix -V option diff --git a/atd.init b/atd.init index e97d73a..98c5fbf 100755 --- a/atd.init +++ b/atd.init @@ -21,24 +21,27 @@ prog="atd" ATD=/usr/sbin/atd LOCK_FILE=/var/lock/subsys/atd -prog="atd" - +[ -f /etc/sysconfig/atd ] || exit 6 + start() { # Check if atd is already running - echo -n $"Starting $prog: " - ##daemon /usr/sbin/atd - $ATD $OPTIONS && success || failure - RETVAL=$? - [ "$RETVAL" = 0 ] && touch $LOCK_FILE - echo + echo -n $"Starting $prog: " + $ATD $OPTIONS && success || failure + RETVAL=$? + [ "$RETVAL" = 0 ] && touch $LOCK_FILE + echo } stop() { echo -n $"Stopping $prog: " - killproc $ATD - RETVAL=$? - [ "$RETVAL" = 0 ] && rm -f $LOCK_FILE - echo + if [ -n "`pidfileofproc $ATD`" ] ; then + killproc $ATD + else + failure $"Stopping $prog" + fi + RETVAL=$? + [ "$RETVAL" = 0 ] && rm -f $LOCK_FILE + echo } @@ -74,7 +77,7 @@ reload) ;; condrestart) if [ -f $LOCK_FILE ]; then - if [ "$RETVAL" = 0]; then + if [ "$RETVAL" = 0 ]; then stop sleep 3 start @@ -86,6 +89,6 @@ status) ;; *) echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}" - RETVAL=1 + RETVAL=3 esac exit $RETVAL