Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Cron job issue, alterntaive file locations
annie
post Jan 3 2006, 10:57 AM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 4
Joined: 3-January 06
Member No.: 5,931



Hi, can anyone explain this behavior to me and possibly sugest how to get the download file where I wan't it?

I'm trying to use mplayer to download a radio stream from the internet and I want to run it as a cron job. If I run this command in a terminal window as root I get the file output to the location/file I asked for (/home/ann/rips/Show.wav)

CODE
mplayer -cache 256 -playlist http://www.station.co.uk/radio/aod/shows/rpms/show.rpm -ao pcm:file=/home/ann/rips/Show.wav -vc dummy -vo null -really-quiet


I know that if you don't specify a file in the -ao pcm option the default is ./audiodump.wav

If I try running it as root via cron job
CODE
46 15 * * 2 root mplayer -cache 256 -playlist http://www.station.co.uk/radio/aod/shows/rpms/show.rpm -ao pcm:file=/home/ann/rips/Show.wav -vc dummy -vo null -really-quiet >/home/ann/rec.log 2>&1


the output is in /audiodump.wav (ie root's home) and not the location specified. I don't get any output if I try my user name in the crontab file.

The root partition (is that the right term?) does not have enough space to hold the download, if it did I would just use a shell script to download then move the file. I need to make it behave in cron as it does from a terminal window and write the output file where I say not the default. I've tried the Mpalyer lists and it seems to be a common problem that no one knows that answer to.

Thanks for any help you can give.
Go to the top of the page
 
+Quote Post
Jim
post Jan 3 2006, 01:56 PM
Post #2


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,280
Joined: 19-November 03
From: University of Minnesota- TC
Member No.: 1,828



I would try putting it in a script anyways and see where that gets your. Just through the whole command in a bash script. Like this

CODE
#! /bin/bash

`mplayer -cache 256 -playlist http://www.station.co.uk/radio/aod/shows/rpms/show.rpm -ao pcm:file=/home/ann/rips/Show.wav -vc dummy -vo null -really-quiet`


If you want to include your logging system, you can go a head and do that too. Just remember you need the ` ` to enclose the command. Then just run that sript from your cron, maybe that will work. Who knows.


--------------------
--Jim Lester
jim@linuxhelp.net

Distro: Gentoo
System: AMD Athlon 3000+ XP 2.166 GHz
NVIDIA nForce2 IGP Chipset
1GB 333 MHz DDR SDRAM
NVIDIA nForce2 Dual Head 64 MB Graphics

Server Distro: CentOS
Go to the top of the page
 
+Quote Post
annie
post Jan 4 2006, 02:07 AM
Post #3


Whats this Lie-nix Thing?
*

Group: Members
Posts: 4
Joined: 3-January 06
Member No.: 5,931



QUOTE (Jim @ Jan 3 2006, 01:56 PM)
I would try putting it in a script anyways and see where that gets you.

Thanks, I've been trying to run it through a shell script and get the same result, it's fine from a terminal window but not as a cron job. I don't understand why they should be different when it's the same PC, OS, user etc. (The OS is Redhat9 by the way)

I don't get any output if I put user ann in the crontab command which I guess is because ann doesn't have rights to the root directory (/). But if the default location for the output is ./ (dot slash) shouldn't that be ann's home directory if the user is ann?
Go to the top of the page
 
+Quote Post
annie
post Jan 4 2006, 02:22 AM
Post #4


Whats this Lie-nix Thing?
*

Group: Members
Posts: 4
Joined: 3-January 06
Member No.: 5,931



laugh.gif laugh.gif laugh.gif

Thanks Jim. While I was posting the last message it struck me that if I put a cd /home/ann in the shell script then ./ would be my home directory and it works. Doesn't explain the strange behavior of cron but hey ho, you can't have everything. smile.gif

For anyone seaching for the solution these are my crontab command and shell script.

CODE
21 7 * * 3 root /home/ann/rec >/home/ann/rec.log 2>&1


CODE
#!/bin/bash

DATE=`date +%F`
echo "recording"
cd /home/ann/rips
rm /home/ann/rips/audiodump.wav  #remove previous audiodump.wav files
mplayer -cache 256 -playlist http://www.station.co.uk/radio/aod/shows/rpms/show.rpm -ao pcm -vc dummy -vo null -really-quiet </dev/null &
#sleep 10800      #sleep for 3hrs
sleep 120    #sleep for 120sec
kill $!      #kill the mplayer job
echo "recording done"
lame /home/ann/rips/audiodump.wav /home/ann/rips/Show$DATE.mp3
echo "all done :)"
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 11th December 2017 - 12:11 PM