mp3 conversion using sox automate with cron
Hi, im trying to convert audio file from .gsm to .mp3 format using sox and lame to be use in asterisk. I created "Makefile" in the audio directory (you can see it below). When i type the command in the CLI it works but when I automate the task using cron it didnt work.
* * * * * cd /path/to/my/dir; make mp3
DIRWAV = $(shell dir *.wav)
ALLWAV = $(DIRWAV:.wav=.mp3)
DIRGSM = $(shell dir *.gsm)
ALLGSM = $(DIRGSM:.gsm=.mp3)
mp3: $(ALLGSM) $(ALLWAV)
nice lame --quiet -h --preset phone "$?" "$@"
rm -f "$?"
nice sox "$?" -r 8000 -c 1 "$@"
rm -f "$?"
I take several test, configuring the cron to send me an email with the result of the 'make mp3' and heres what I got.
nice sox "get.gsm" -r 8000 -c 1 "get.wav"
rm -f "get.gsm"
nice lame --quiet -h --preset phone "get.wav" "get.mp3"
nice: lame: No such file or directory
make: *** [get.mp3] Error 127
Its not creating .wav file and .mp3 but i know the command is working when i tested it in the cli. Any help and suggestion is appreciated.
When using crontab, the PATH variable is absent.
So, specify the full path to lame and sox.
To get the full path use which lame
I hope it helps.
Thank you Vit77 for the reply and yes it helps. Actually the PATH variable is not absent it uses the /usr/bin directory, so if i run the lame in the cron it becomes /usr/bin/lame which will not work, I noticed this when the old lame version installed through rpm is executed instead of the latest one which is under /usr/local/bin directory. So i have to change to its real path to work. Thanks.
|All times are GMT -5. The time now is 07:58 AM.|