我将此脚本作为root用户添加到root cron中,如下所示,但它不起作用,可能是什么错误?它是suse 10 sp2可能与添加crontabs的方式不同?
$Crontab -e
35 11 * * * /home/see/rbirun/send/VPN/Mobile/packaging_cdr_script3.sh
drFEP1a:/home/see/rbirun/send/VPN/Mobile # more packaging_cdr_script3.sh
#!/bin/bash
DATE=`date '+%Y%m%d'`
FILE="cdr_backup_${DATE}.tar.gz"
TEMPFILE="tempfile_${DATE}"
DESTINATION=/root/patrick_temp/
ERROR="Tar file has not been created nor removed the source call records"
find . -name 'VPN_CALLRECORD*' -type f -ctime 1 -print > ${TEMPFILE}
tar -czf ${FILE} -T ${TEMPFILE}
if [ -f $FILE ];
then
mv cdr_backup* ${DESTINATION}
number=$(more ${TEMPFILE} |wc -l)
echo "$DATE:Number of files backed up-->$number ">>log_after_cdr_backup.txt
else
echo "$DATE:$ERROR">>log_after_cdr_backup.txt
fi
drFEP1a:/home/see/rbirun/send/VPN/Mobile # ls -lhrt packaging_cdr_script*
-rwxrwxrwx 1 root root 547 Jan 21 11:21 packaging_cdr_script3.sh
drFEP1a:/home/see/rbirun/send/VPN/Mobile # more /etc/crontab
SHELL=/bin/sh
PATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin
MAILTO=root
#
# check scripts in cron.hourly, cron.daily, cron.weekly, and cron.monthly
#
-*/15 * * * * root test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons>/dev/null 2>&1