I can't get cron to run my script and I'm out of ideas. I'm running Ubuntu 10.04 on this machine. The script works from the command line with no problems. Other test scripts work and are set up the same as timelapvid.
here's my crontab -e, where bench is the user name:
00 00 * * * /home/bin/bench/timelapvid >> /home/bin/timelapvid.log
In Ubuntu the ~/bin directory is added to the PATH variable at login, to avoid modifying /bin.
The contents of timelapvid:
## timelapse is a dir开发者_如何学Python which contains the still pics
cd ~/bin/timelapse || exit
## only work on new pics, remove the colon, dvd-slideshow doesn't like it
ls -1 | grep : > list
for i in `cat list`
do
mv $i `echo $i | sed 's/:/./g'`
done
#build the slide show list and change the time for each slide
dir2slideshow -n "Time Lapse Video" . && sed -i 's/:5/:0.5/g' "Time Lapse Video.txt"
# remove the last three lines of the above .txt
lines=$(wc -l < "Time Lapse Video.txt")
target=$((lines-2))
sed -i "$target,$lines d" "Time Lapse Video.txt"
# make the time on the last slide longer
lines=$(wc -l < "Time Lapse Video.txt")
sed -i ""$lines"s/:0.5/:3/" "Time Lapse Video.txt"
dvd-slideshow -f "Time Lapse Video.txt" && mv "Time Lapse Video.vob" ../video /TimeLapseVideo.vob
rm list
### Update Web Page
rsync -r --delete ~/bin/video/ user@sever:public_html/circuits/timelap/video/
echo -e "\n****UPDATE SUCCESSFUL****\n"
thank you, wbg
Cron uses its own minimal environment. So ~
makes no sense in your script. You could use $HOME
if you define it in your crontab:
# environment
HOME=/home/wbg
# tasks
00 00 * * * /home/bin/bench/timelapvid >> /home/bin/timelapvid.log
Besides, are you sure of your /home/bin
path? Isn't is something like /home/wbg/bin
?
精彩评论