Problem executing script through at


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem executing script through at
# 1  
Old 04-05-2009
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?

Code:
#!/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:
Code:
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
Code:
ev/null

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

Quote:
/bin/sh --version
GNU bash, version 3.1.17(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

at -V
at version 3.1.9
Bug reports to: rmurray@debian.org (Ryan Murray)
Garbled time
I'm using Debian 4.0 btw.

thanks in advance for any advice
viktor
# 2  
Old 04-05-2009
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
# 3  
Old 04-06-2009
when starting manually I do it the followin way:
Code:
# 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:
Code:
# 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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

having problem while executing the script

Hi i am getting stuck while executing the script in the below line .Please help me out if ;then Name=`grep -i $Size $FILE|awk '{print $(NF-1),$NF}' |head -1` else Name="$Nam" fi (3 Replies)
Discussion started by: soumyamishra
3 Replies

2. UNIX for Dummies Questions & Answers

problem in Executing script in ksh

Hi, I am in ksh. below mentioned 3 commands I executed at command prompt & got the expected results. csh source csh_infa <special command> Now I have to do this in the script in ksh. I entered it as it is. #!/bin/ksh csh source csh_infa <special command> Now after... (1 Reply)
Discussion started by: girish_kanak
1 Replies

3. Homework & Coursework Questions

Problem with executing a possible if or case statement script

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Create a phonebook program. It should use functions to perform the required tasks. It should be menu-based,... (1 Reply)
Discussion started by: Rgasin02
1 Replies

4. UNIX for Dummies Questions & Answers

Error Executing a script(SSH problem)

Hi i m writing a script which will fetch data from different machines and display it on single terminal. I have created a file named SERVERNAMES containing ip address of machines i need to monitor. Then for every IP i m issuing ssh command to get date on that machine. However When i m trying... (3 Replies)
Discussion started by: pinga123
3 Replies

5. Shell Programming and Scripting

Problem with executing a shell script through the cron

Hi, I have a shell script as below: ORACLE_HOME=/usr/local/opt/oracle/product/dev export ORACLE_HOME PATH=$PATH:$ORACLE_HOME/bin:/usr/bin export PATH OUTFILE=/export/home/`basename $0`.out export OUTFILE export IDEN df -k . | tail -1 | read a b c d e f echo $a >> $OUTFILE echo $b... (4 Replies)
Discussion started by: Abhinav Pandey
4 Replies

6. Shell Programming and Scripting

Problem executing a script

Hi Friends, When I try to execute one of my script script1.shl, I am getting the error message as "/tmp/sh1871978.13: cannot create" . I could not find the specified sh* file in the /tmp directory and I also checked the disk space of /tmp and it is only 60% filled. Please help me on... (5 Replies)
Discussion started by: mr_manii
5 Replies

7. Shell Programming and Scripting

Problem with executing script using ssh

I'm writing a script which is meant to ssh into a remote machine, sed a file there, and write the output to a new file on the remote machine. Obviously the easy way to do this is to write and execute the script on the remote machine, but I'm trying to do this all via ssh since I like to keep and... (4 Replies)
Discussion started by: maethlin
4 Replies

8. Shell Programming and Scripting

Problem executing a script

The script startserver.sh has permissions to execute. Still the nohup command returns error with 'No such file or directory' Any sugggestions: $ nohup ./startserver.sh & Error $ nohup: appending output to `nohup.out' nohup: cannot run command `./startserver.sh': No such file or... (4 Replies)
Discussion started by: hemangjani
4 Replies

9. Shell Programming and Scripting

Problem with executing a script scheduled in crontab

Hi I have written a shell script(in Solaris) in which following logic is there..... i=1 while read control do key=`echo $control | awk -F$DELIMITOR '{ print $1 }'` echo "Key Values" ${key} i=`/usr/bin/expr $i + 1` done < $CONFPATH/$CONFFILE when i execute it at prompt it... (4 Replies)
Discussion started by: Amardeep
4 Replies

10. Shell Programming and Scripting

Problem executing setuid script in perl-5.8.6

Hi, I have a script (a.pl) that can be run by anyone. The script internally has to read a file and write into few files which are owned by user 'myUser'. Has to read the following file: -rwx------ 1 myuser myuser 4986 Aug 20 18:11 my.file Has to write into following files: ... (0 Replies)
Discussion started by: sarmakdvsr
0 Replies
Login or Register to Ask a Question