Package: at
Version: 3.1.9

when launching atd it's preferable to clean the environment -- in 
particular things like SSH* env vars or even LOGNAME can leak into the 
environment of the daemon.  i've seen this cause problems such as atd 
sending mail as 'dean' rather than 'root' when i restart it.

note this affects only atd's environment... the environment of jobs is 
handled by atd itself.

patch below.

-dean

p.s. i had to fix the --pidvfile restart bug ... not sure if i fixed it 
the same way you did or not.

--- /etc/init.d/atd     2005/09/12 16:27:32     1.1
+++ /etc/init.d/atd     2005/09/12 16:40:00
@@ -11,6 +11,10 @@
 DAEMON=/usr/sbin/atd
 PIDFILE=/var/run/atd.pid
 
+# clean the environment to prevent things like USER/LOGNAME/SSH* env vars
+# from leaking into at jobs
+cleanenv="env -i SHELL=/bin/sh LANG=C PATH=$PATH USER=root LOGNAME=root"
+
 # Arguments to atd
 #
 ARGS=""
@@ -20,7 +24,7 @@
 case "$1" in
   start)
     echo -n "Starting deferred execution scheduler: atd"
-    start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON -- 
$ARGS
+    $cleanenv start-stop-daemon --start --quiet --pidfile $PIDFILE --startas 
$DAEMON -- $ARGS
     echo "."
     ;;
   stop)
@@ -33,8 +37,8 @@
     ;;
   force-reload|restart)
     echo -n "Restarting deferred execution scheduler: atd"
-    start-stop-daemon --stop --quiet --oknodo --retry 30 --pidvfile $PIDFILE 
--name $DAEMON
-    start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON -- 
$ARGS
+    start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE 
--exec $DAEMON
+    $cleanenv start-stop-daemon --start --quiet --pidfile $PIDFILE --startas 
$DAEMON -- $ARGS
     echo "."
     ;;
   *)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to