nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Problem executing script through at

This is a discussion on Problem executing script through at within the Shell scripting forums, part of the Development/Scripting category; Hey fellows, i've got a probkem while executing a command through a scheduled at-job; Somehow my script starts looping, when ...

Register free or login to your existing account and remove all advertisements.


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Linux answers from nixCraft.


Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-06-2009, 11:40 PM
Junior Member
User
 
Join Date: Apr 2009
OS: Debian
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
viktor4124 is on a distinguished road
Default 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.


this is the way i start the script manually, btw:

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
and this the way i do it using at:
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
atjob_xtrace.sh is the script from the beginning

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.

thx in advance
viktor
Reply With Quote
  #2 (permalink)  
Old 04-07-2009, 12:09 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,680
Thanks: 11
Thanked 241 Times in 181 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Try using full path names for binaries for example you should use mplayer full path such as /usr/bin/mplayer.
__________________
Vivek Gite
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
"tar xvf" command is executing very slow prahladkumar CentOS / RHEL / Fedora 0 04-02-2009 03:44 PM
Executing .exe files in Red Hat Linux AS4 shilpigoel1 Linux software 2 12-09-2008 07:34 PM
cgi script downloads - instead of executing sathiya Ubuntu / Debian 2 06-13-2008 01:14 PM
avoid displaying errors while executing a script vikas027 Shell scripting 4 10-31-2007 11:57 AM
problem in script sania Getting started tutorials 0 09-14-2007 04:25 PM


All times are GMT +5.5. The time now is 08:45 PM.


Powered by vBulletin® Version 3.8.4 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2009 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38