我在Ubuntu 10.04 LTS服務器上從root cron運行組合備份腳本。Ubuntu root Cron作業未完成
根的cron是這樣的:
# m h dom mon dow command
0 1 * * 2-6 /home/cbhiadmin/archive
,因爲它的預期它的執行。歸檔命令啓動了幾個單獨的設備備份。代碼如下:
#!/bin/bash
# This script executes several individual facility archive processes & logs success.
/home/cbhiadmin/archive104
/home/cbhiadmin/archive106
if [ $? -ne 0 ]; then
echo "$(date '+%m/%d/%y-%H:%M') Nightly Addon backup SUCCESSFUL" >> /home/cbhiadmin/addon_backups/addon_backup.log
exit
fi
然後最後一部分是個人設備備份操作如下:
#!/bin/bash
# This script archives a facility, FTPs the archive to 10.5.2.76, & logs failure.
today=$(date '+%m%d%y')
site="106"
cd /home/cbhiadmin/addon_backups/"$site"
if [ ! -f "$site"adata_"$today".tar.gz ]; then
tar --exclude *.CSV --exclude *.csv -czf "$site"adata_"$today".tar.gz -C /usr/bbx/aon/ "$site"/ADATA/
if [ $? -ne 0 ];then
echo "$(date '+%m/%d/%y-%H:%M') $site: Nightly Addon backup FAILED" >> /home/cbhiadmin/addon_backups/addon_backup.log
fi
fi
cp "$site"adata_"$today".tar.gz /home/cbhiadmin/SAN/"$site"
find ~/SAN/"$site"/*.tar.gz -maxdepth 1 -mtime +60 -exec rm {} +
我的問題是,在最後一行似乎並沒有從根本上cron的工作,但當我以root用戶身份運行存檔時起作用。
什麼是缺失?