2011-09-01 51 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