Hongbo Ma wrote: >I wrote a script called full_backup.sh to do bakcup. It is supposed to >run at a given time everyday. I log in as root, and type "crontab -e" >add a entry like following to the crontab file: >******************************* >15 18 * * * /usr/local/bin/full_backup.sh >******************************** > > >The content of the full_backup.sh (I put it under /usr/local/bin) is: > >****************************************** >#!/bin/sh >mt -f /dev/nst0 rewind > >rm /var/log/tar/snapshot > >tar -cvpf /dev/nst0 --label="Full Backup Set Created >on `date '+%d-%B-%y'`." --listed-incremental=/var/log >/tar/snapshot /home/hma/project >******************************************* > >I can run this script with no problem manually and get my archive file >on tape. However, if I use cron, although it IS triggered by cron, the >'tar' command in the script didn't run successfully. That is to say, I >know the script was executed by checking the consequence of >"rm /var/log/tar/snapshot", but I didn't get the archive file on tape. > >Strangely, if I changed the backup target directory from the >"/home/hma/project" to "home/hma/proposal", then every thing is fine. I >get the archive file on tape. "proposal" directory is about 3MB, while >"project" directory is about 700MB. But the size should not be a >problem, since I can manually run the script to backup "project" >correclty. > >Obiousely, something is wrong with my cron, but I just don't know how to >correct it. Currently, I don't have sendmail program installed on my >system, so I can't get the email cron is supposed to send to me. > >Any help is highly appreciated!! > >Hongbo Ma > > > > cron 文件里面命令用绝对路径比较好,毕竟在命令行下执行时有路径的环境变 量,到了cron里面就没有了。
或者你在cron文件里面定义也可以。 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]