Added -u options by request.
Removed line for running log cleanup prior to backup.
Added abort warning.
This commit is contained in:
woogerboy21 2015-07-11 15:41:59 -04:00
parent 04c09647d7
commit 10019bf985
2 changed files with 12 additions and 6 deletions

View file

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
set -u
SLEEPTIME=5 SLEEPTIME=5
SQLCONFFILE="./mysql.cnf" #set this to the path that contains the mysql.cnf file SQLCONFFILE="./mysql.cnf" #set this to the path that contains the mysql.cnf file
LOGAPPENDDATE=`date +%m%d%Y` LOGAPPENDDATE=`date +%m%d%Y`
@ -25,11 +26,11 @@ TABLES=(
"cockatrice_servers" "cockatrice_servers"
"cockatrice_news" "cockatrice_news"
"cockatrice_rooms" "cockatrice_rooms"
"cockatrice_rooms_gametypes" "cockatrice_rooms_gametypes"
) )
/home/wwadmin/scripts/db_maint_logs
PROCESSNAME="mysqldump" PROCESSNAME="mysqldump"
#COMMANDRESULTS=`ps -e |grep $PROCESSNAME |grep -v grep` COMMANDRESULTS=`ps -e |grep $PROCESSNAME |grep -v grep`
if [ -z "$COMMANDRESULTS" ]; if [ -z "$COMMANDRESULTS" ];
then then
[ ! -d $BACKUPDIR ] && mkdir -p $BACKUPDIR/ [ ! -d $BACKUPDIR ] && mkdir -p $BACKUPDIR/
@ -41,4 +42,6 @@ then
sleep $SLEEPTIME sleep $SLEEPTIME
done done
rm -rf "$ROOTFOLDER/$EXPIRATION/" rm -rf "$ROOTFOLDER/$EXPIRATION/"
else
echo "Backup in progress, aborting"
fi fi

View file

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
set -u
SLEEPTIME=5 SLEEPTIME=5
SQLCONFFILE="./mysql.cnf" #set this to the path that contains the mysql.cnf file SQLCONFFILE="./mysql.cnf" #set this to the path that contains the mysql.cnf file
LOGAPPENDDATE=`date +%m%d%Y` LOGAPPENDDATE=`date +%m%d%Y`
@ -25,11 +26,11 @@ TABLES=(
"cockatrice_servers" "cockatrice_servers"
"cockatrice_news" "cockatrice_news"
"cockatrice_rooms" "cockatrice_rooms"
"cockatrice_rooms_gametypes" "cockatrice_rooms_gametypes"
) )
/home/wwadmin/scripts/db_maint_logs
PROCESSNAME="mysqldump" PROCESSNAME="mysqldump"
#COMMANDRESULTS=`ps -e |grep $PROCESSNAME |grep -v grep` COMMANDRESULTS=`ps -e |grep $PROCESSNAME |grep -v grep`
if [ -z "$COMMANDRESULTS" ]; if [ -z "$COMMANDRESULTS" ];
then then
[ ! -d $BACKUPDIR ] && mkdir -p $BACKUPDIR/ [ ! -d $BACKUPDIR ] && mkdir -p $BACKUPDIR/
@ -47,4 +48,6 @@ then
fi fi
done done
rm -rf "$ROOTFOLDER/$EXPIRATION/" rm -rf "$ROOTFOLDER/$EXPIRATION/"
else
echo "Restore in progress, aborting"
fi fi