Running shell scripts with cron
I've been having a bit of trouble running a shell script with cron.
A friend of mine does a community radio show and the station has a live stream but no podcasts, so I've set up a script to record the stream and encode it as an mp3 while I'm away using mplayer and lame -that's what I'm trying to do anyway
Here's the script, but it doesn't seem to run- at least, I don't see any of the files it should be outputing, would they be in the cron.weekly directory (where I have the script) or in my home directory?
#This is a script to record 'The Unnamed Show'
#it will record the show from the live stream, then convert the output #to an MP3
#Finally, it will delete any files no longer required
58 12 * fri root mplayer -dumpstream http://184.108.40.206:8000/listen.pls
02 2 * fri root killall mplayer
04 2 * fri root mplayer -ao pcm stream.dump
35 2 * fri root lame audiodump.wav The_Unnamed_Show.mp3
05 3 * fri root chmod 777 The_Unnamed_Show.mp3
30 3 * fri root rm stream.dump
31 3 * fri root rm dumpstream.wav
Also, you have to provide full paths to the data files. Setting:
I'm also not sure about writing each command in your crontab, which is what that looks like you're doing. The only time-sensitive part seems to be the dumpstream. So you could just have a file with something like
Also, while it may not be recommended, I run my cron scripts through a wrapper which then runs the scripts. This gives me the shell and environment I want. This is "Dillon's cron" on Slackware - other distros seem to use really weird crons. FWIW, the essentials of it are simply:
|All times are GMT -5. The time now is 06:00 PM.|