script runs fine from a command line, but doesn't work from cron?
This is a reasonably simple bash script to compress any new wav files in the audio directory into MP3. I know I could have lame be the command in the if statement... but I like it like this.
Anyway, when I issue the command as root from the console, it works flawlessly. When it runs from cron, it starts and exits instantaneously. The wav is deleted, and the mp3 "encoded" in under a quarter of a second. Yeah right. No MP3 output whatsoever. Why does it work just fine from the console, but dies from cron? Permissions for the script are 4777. Code:
#!/bin/bash |
"Anyway, when I issue the command as root from the console, it works flawlessly. When it runs from cron, it starts and exits instantaneously."
When you execute the script in cron are you using the full path name to the script? cron does not have much of a PATH. What is the ownership of the command? I think that it has to be root root for cron to be able to execute it. ___________________________________ Be prepared. Create a LifeBoat CD. http://users.rcn.com/srstites/LifeBo...home.page.html Steve Stites |
File ownership is root, file permission in 4777.
Yes, I issue the full path. I get entries to the log file, so I know it is running. |
"Yes, I issue the full path. I get entries to the log file, so I know it is running."
All of the commands that you issue in the script are in /bin except lame. Where is lame? Is it in the cron PATH? You may have to give the full pathname for the lame command. To find out what the cron PATH is you could put this command in the script: echo $PATH >> /scripts/encode_output ___________________________________ Be prepared. Create a LifeBoat CD. http://users.rcn.com/srstites/LifeBo...home.page.html Steve Stites |
lame is in /bin as well.. I copied it in there.
|
The simplest solution is to check you PATH variable by using 'echo $PATH' in your shell and then pasting that information on the second line of your script...
Something like this: Code:
#!/bin/bash |
All times are GMT -5. The time now is 04:34 AM. |