LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-05-2006, 11:29 AM   #1
mma8x
Member
 
Registered: Jul 2004
Posts: 164

Rep: Reputation: 30
cron won't run commands?


trying to set up a simple crontab entry to record streaming radio progs:
Code:
0 9 * * 1,2,3,4,5       /home/xxxx/Scripts/neil
#
0 11 * * 1,2,3,4,5      killall -9 mplayer
script neil is:

Code:
#!/bin/bash
mplayer -playlist /home/xxxx/Scripts/WTBQ.asx -ao pcm:file=/multimedia/RadioProgs/neil_`date +%m_%d_%y`.wav&;
lame /multimedia/RadioProgs/neil_`date +%m_%d_%y`.wav /multimedia/RadioProgs/neil_`date +%m_%d_%y`.mp3;
rm /multimedia/RadioProgs/neil_`date +%m_%d_%y`.wav;
now, i'm getting the following in my logs:

Code:
Apr  5 09:00:01 localhost /USR/SBIN/CRON[13576]: (xxxx) CMD (/home/xxxx/Scripts/neil)
but nothing seems to happen. the script works fine from command line. testing cron,
Code:
* * * * * echo hello >> /multimedia/RadioProgs/test.txt
works fine, but
Code:
* * * * * /usr/bin/date >> /multimedia/RadioProgs/test.txt
doesn't. same result with any other commands (though log output shows that cron is running them). not quite sure what i'm doing wrong here, though it's probably something simple/stupid.
 
Old 04-05-2006, 11:49 AM   #2
mma8x
Member
 
Registered: Jul 2004
Posts: 164

Original Poster
Rep: Reputation: 30
forgot to mention that if i run the script with cron, i can ps aux|grep mplayer, and it IS running. however, du /multimedia/RadioProgs shows nothing being written. again, running the identical command from the prompt works fine.
 
Old 04-05-2006, 11:54 AM   #3
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
You need to specify a DISPLAY variable to graphical programs display their output.
Try to put in the beginning of your script:
Code:
export DISPLAY=:0.0
Of course, the X must be running and owned by the owner of the cron job.
 
Old 04-05-2006, 12:15 PM   #4
mma8x
Member
 
Registered: Jul 2004
Posts: 164

Original Poster
Rep: Reputation: 30
i'll try it, but these aren't graphical programs; mplayer is using pcm to just output to a file, right? and why shouldn't the simple date >> text job work?
 
Old 04-05-2006, 12:25 PM   #5
mma8x
Member
 
Registered: Jul 2004
Posts: 164

Original Poster
Rep: Reputation: 30
huh. that definitely worked, thanks! i guess mplayer is still using X for the soundserver?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[Torrent] CRON and Console commands Tanc Linux - Newbie 1 05-26-2005 12:00 PM
cron weekly does not run jordanthompson Linux - Software 21 01-16-2005 09:52 AM
trying to get cron to run naijaguy Linux - General 12 08-18-2004 05:32 PM
Help with Cron commands ozstar Linux - Newbie 2 05-03-2004 04:07 PM
No mail in Solaris Cron commands markraem Solaris / OpenSolaris 1 01-05-2004 03:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration