LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   script won't run in crontab(centos 5) (https://www.linuxquestions.org/questions/programming-9/script-wont-run-in-crontab-centos-5-a-626859/)

ncsuapex 03-09-2008 05:40 PM

script won't run in crontab(centos 5)
 
I have a sox|lame one line script that has served me well on other distros of linux but for some reason it will not work on my centos 5 PC.

script records from line in using sox then I pipe it through lame to re-encode it.

I've tried

37 17 09 3 * sox -t ossdsp -w -s -r 44100 -c 2 /dev/dsp -t raw - | lame -x -m s - ~/test`date +%b%d_%Y`.mp3

37 17 09 3 * sox -t ossdsp -w -s -r 44100 -c 2 /dev/dsp -t raw - | lame -x -m s - ~/test'date +%b%d_%Y'.mp3


the problem is with the 'date +%b%d_%Y' portion.


I get this in mail

sox -t ossdsp -w -s -r 44100 -c 2 /dev/dsp -t raw - | lame -x -m s - ~/test'date +
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/username>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=username>
X-Cron-Env: <USER=username>

/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file



both scripts fail with the same basic message.

basically I want the script to add the date/time/etc to a filename.


thanks!

ta0kira 03-09-2008 06:08 PM

Try $(date +%b%d_%Y) and maybe put the file name in "" (~/"test$(date +%b%d_%Y).mp3".)
ta0kira

ncsuapex 03-09-2008 07:55 PM

Ok I found a work around. I tested the script in the terminal and it work. I'll just throw it in a file and run the file from cron.


thanks!




sox -t ossdsp -w -s -r 44100 -c 2 /dev/dsp -t raw - | lame -x -m s - ~/test`date +%b%d_%Y`.mp3


All times are GMT -5. The time now is 11:55 AM.