crontab -e
10 0 * * 7 sh /backup/dominobackup.sh
[root@mail backup]# vi dominobackup.sh
#################################
## author : chenjunyong ##
## Time : 2018-3-1 ##
## file : dominobackup.sh ##
## back domino server bash ##
#!/bin/bash
DOM_HOME=/opt/lotus/notesdata/
DOM_USER=notesinstall
DOM_PROG=/opt/lotus/bin
DAT=`date +%Y-%m-%d`
DST="/nas/fullback/"
LOG=$DST
echo "Starting Backup" > $LOG/back$DAT.log
###################################################################
echo -n Stopping domino: >> $LOG/back$DAT.log
cd $DOM_HOME
echo Y | su $DOM_USER -c "$DOM_PROG/server -q"
###################################################################
echo -n kill domino: >> $LOG/back$DAT.log
count=`ps -ef |grep notes/latest |grep -v "grep" |wc -l`
if [ $count -eq 0 ]; then
echo "seccess to quit" >> $LOG/back$DAT.log
else
su $DOM_USER -c "$DOM_PROG/nsd -kill " >> $LOG/back$DAT.log
fi
###################################################################
mkdir $DST$DAT/
echo "pls waiting! backuping Data now" >> $LOG/back$DAT.log
cp -rvp /opt/lotus/notesdata/. $DST$DAT/ >> $LOG/back$DAT.log
#if [ $? -eq 0 ];then
# echo "ChinaFair mailbackup has been finished successfully" | mail -s "mailbackup successfully" admin@chinafairproperties.com < $LOG/back$DAT.log
#else
# echo "ChinaFair mailbackup failed" | mail -s "mysql backup failed" admin@chinafairproperties.com < $LOG/back$DAT.log
#fi
echo "Finished COPY!" >> $LOG/back$DAT.log
###################################################################
echo -n Starting domino:
count=`ps -ef |grep notes/latest |grep -v "grep" |wc -l`
if [ $count -eq 0 ]; then
su $DOM_USER -c "$DOM_PROG/server"
else
su $DOM_USER -c "$DOM_PROG/nsd -kill " >> $LOG/back$DAT.log
su $DOM_USER -c "$DOM_PROG/server"
fi
###################################################################
echo "Backup Finished !" >> $LOG/back$DAT.log
转载于:https://blog.51cto.com/junch/2299291