2011-09-01 94 views
0

我不能让cron运行我的脚本,我没有想法。 我在这台机器上运行Ubuntu 10.04。 该脚本可以在命令行中正常工作,没有任何问题。其他测试脚本工作 并设置为timelapvid相同。克朗不会运行我的脚本

,这里是我的crontab -e,其中替补用户名:

00 00 * * * /home/bin/bench/timelapvid >> /home/bin/timelapvid.log 

在Ubuntu中的〜/ bin目录添加到PATH变量在登录时,避免修改/箱。

timelapvid的内容:

## timelapse is a dir 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/ [email protected]:public_html/circuits/timelap/video/ 

echo -e "\n****UPDATE SUCCESSFUL****\n" 

谢谢你, WBG

回答

1

的Cron使用自己的最小环境。所以~在你的脚本中没有任何意义。你可以使用$HOME,如果你在你的crontab定义它:

# environment 
HOME=/home/wbg 
# tasks 
00 00 * * * /home/bin/bench/timelapvid >> /home/bin/timelapvid.log 

另外,你确定你的/home/bin路径?是不是像/home/wbg/bin