您好,登錄后才能下訂單哦!
[db2inst1@db2 ~]$ crontab -l
30 02 * * * /bin/sh /home/db2inst1/backup/backup.sh
[db2inst1@db2 ~]$ cat /home/db2inst1/backup/backup.sh
#!/bin/bash
bakdir=/home/db2inst1/backup
time1=`date +"%Y-%m-%d %H:%M:%S"`
cd $bakdir
echo $time1 >> $bakdir/backup.log
/home/db2inst1/sqllib/bin/db2 backup db devdb104 online
if [ $? -eq 0 ];then
time2=`date +"%Y-%m-%d %H:%M:%S"`
echo "the database backup is successfully completed at $time2" >> $bakdir/backup.log
else
echo "the database backup is failed" >> $bakdir/backup.log
fi
/bin/find /home/db2inst1/backup/ -type f -iname "devdb104.0.db2inst1.NODE0000.CATN0000*" -mtime +1 -exec rm -rf {} \;
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。