我有一个 cron 脚本,我需要调整它;实际上,一些客户端正在目录中生成一些文件,我的任务是将该文件备份到磁带上,我需要制作一个 if then else
cp $files $tape
if exit 0
then
send successfully mail
delete files
else
send a fail mail
but don't delete that files
fi
有人可以帮我吗?
也许类似这样?实际上代码是这样的
find $STR_FILES -print | backup -ivq -f $TAPE >> /tmp/logfile
你说我必须放那样的东西?
BKP='find $STR_FILES -print | backup -ivq -f $TAPE'
$BKP >> /tmp/logfile
if [$BKP -eq 0 ]
then
...
else
...
fi
?
实际上我做了一个测试
实际上我确实做了 cd / find /u01 -name ora_856562.aud
if ["$?" = "0" ]; then
rm /u01/app/oracle/product/10.2.0/db_1/rdbms/audit/ora_856562.aud
(echo "Se depuraron *.aud Ok") | mail -r [email protected] -s "Prueba if" [email protected]
else
(echo "NO Se depuraron *.aud Ok") | mail -r [email protected] -s "Prueba if" [email protected]
fi
exit
但失败了
./prueba.sh[3]: 0: not found.
./prueba.sh[5]: [127: not found.