Commit 9338e7e7 authored by woogerboy21's avatar woogerboy21
Browse files

Added -e option

Added -e option by request
Updated process checking method to allow -e option
parent 10019bf9
#!/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=( ...@@ -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[@]}"
......
#!/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=( ...@@ -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[@]}"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment