3

I have a script that's supposed to record a shoutcast stream for an hour, convert it to mp3, and then save it. The script runs correctly when I run it from the terminal, but I can't seem to get it to run in cron (where it should run every hour at the top of the hour).

Here's the line in crontab:

0 * * * * /medialib/tech/bin/recordstream 2>&1 >> /medialib/tech/cron.log

and here's the script:

#!/bin/bash
name="$(date +%s)"

mp3_name=$name.mp3
wav_name=$name.wav

timeout -sHUP 60m vlc -I dummy --sout "#transcode{channels=2}:std{access=file,mux=wav,dst=/medialib/stream_backup/wav/$wav_name" /medialib/tech/lib/listen.m3u

lame --mp3input /medialib/stream_backup/wav/$wav_name /medialib/stream_backup/$mp3_name

rm /medialib/stream_backup/wav/$wav_name

Thank you!

EDIT: Contents of cron.log (This text has been in the log file since it was transferred from an old server where it was working).

VLC media player 2.0.8 Twoflower
Command Line Interface initialized. Type `help' for help.
> Shutting down.
VLC media player 2.0.8 Twoflower
Command Line Interface initialized. Type `help' for help.
> Shutting down.

1 Answers1

0

Firstly try to see if cron is running

ps -ef | grep cron

If it is not running, start it as root

sudo /etc/init.d/cron start (Ubuntu and Red Hat).

Secondly, check the permissions of the script, if it have the "x" option and then try to run

crontab -e

Try to see if the cron you made is listed with this command

crontab -l

EDIT:

Try to add /bin/bash right before your script call :

0 * * * * /bin/bash /script/file

Any more clues to solve it here.