Problem executing script through at

Hey fellows,

i've got a probkem while executing a command through a scheduled at-job;
Somehow my script starts looping, when triggered throug at;
It doesnt do so if started manually.
Any ideas?

#!/bin/sh
# atrun uid=33 gid=33
# mail www-data 0
umask 22
cd /var/django/webripper/ripper || {
     echo 'Execution directory inaccessible' >&2
     exit 1
}
set -o xtrace ; mplayer -dumpstream mms://stream1.orf.at/fm4_live -really-quiet -dumpfile /var/www/media/recordings/test.wmv < /dev/null &> /dev/null & 
MPID=$! ; echo $$ > /var/www/media/recordings/test.pid ; 
echo $MPID $$ $! ; 
sleep 60 ;
kill $MPID ; 
exit 0 ;

here's the output when xtrace is enabled:

Subject: Output from your job       20
To: www-data

+ mplayer -dumpstream mms://stream1.orf.at/fm4_live -really-quiet -dumpfile /var/www/media/recordings/test.wmv
+ MPID=20360
+ echo 20357
+ echo 20360 20357 20360
20360 20357 20360
+ sleep 60
+ ev/null
+ MPID=22321
+ echo 20357
+ echo 22321 20357 22321
22321 20357 22321
+ sleep 60

I have no idea where the

ev/null

is coming from, neither why the whole thing starts looping.

I'm using Debian 4.0 btw.

thanks in advance for any advice
viktor

can you paste the how you are starting this job with at command
and kill $MPID won't kill the process it will just stop the process if you wanna kill use
kill -kill pid or kill -9 pid

when starting manually I do it the followin way:

# sudo -u www-data /bin/sh  atjob_xtrace.sh 
+ mplayer -dumpstream mms://stream1.orf.at/fm4_live -really-quiet -dumpfile /var/www/media/recordings/test.wmv
+ MPID=5693
+ echo 5692
+ echo 5693 5692 5693
5693 5692 5693
+ sleep 60
+ kill 5693
+ exit 0

starting through at involves:

# sudo -u www-data at now -f atjob_xtrace.sh 
warning: commands will be executed using /bin/sh
job 22 at Mon Apr  6 19:51:00 2009

# cat /var/spool/cron/atspool/a00016013b1aaf 
Subject: Output from your job       22
To: root

+ mplayer -dumpstream mms://stream1.orf.at/fm4_live -really-quiet -dumpfile /var/www/media/recordings/test.wmv
+ MPID=20321
+ echo 20318
+ echo 20321 20318 20321
20321 20318 20321
+ sleep 60
+ dev/null
+ MPID=21911
+ echo 20318
+ echo 21911 20318 21911
21911 20318 21911
+ sleep 60

edit: ah, ja and atjob_xtrace.sh is the script shown in my first post

thx in advance
viktor