Added -e option

Added -e option by request
Updated process checking method to allow -e option
This commit is contained in:
woogerboy21 2015-07-11 16:35:12 -04:00
parent 10019bf985
commit 9338e7e71f
2 changed files with 4 additions and 4 deletions

View file

@ -1,5 +1,6 @@
#!/bin/bash #!/bin/bash
set -u set -u
set -e
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`
@ -30,8 +31,7 @@ TABLES=(
) )
PROCESSNAME="mysqldump" PROCESSNAME="mysqldump"
COMMANDRESULTS=`ps -e |grep $PROCESSNAME |grep -v grep` if [ "$(pgrep $PROCESSNAME)" == "" ];
if [ -z "$COMMANDRESULTS" ];
then then
[ ! -d $BACKUPDIR ] && mkdir -p $BACKUPDIR/ [ ! -d $BACKUPDIR ] && mkdir -p $BACKUPDIR/
for TABLENAME in "${TABLES[@]}" for TABLENAME in "${TABLES[@]}"

View file

@ -1,5 +1,6 @@
#!/bin/bash #!/bin/bash
set -u set -u
set -e
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`
@ -30,8 +31,7 @@ TABLES=(
) )
PROCESSNAME="mysqldump" PROCESSNAME="mysqldump"
COMMANDRESULTS=`ps -e |grep $PROCESSNAME |grep -v grep` if [ "$(pgrep $PROCESSNAME)" == "" ];
if [ -z "$COMMANDRESULTS" ];
then then
[ ! -d $BACKUPDIR ] && mkdir -p $BACKUPDIR/ [ ! -d $BACKUPDIR ] && mkdir -p $BACKUPDIR/
for TABLENAME in "${TABLES[@]}" for TABLENAME in "${TABLES[@]}"