From 9338e7e71f3ec9e28763d0e23800763ef1773123 Mon Sep 17 00:00:00 2001 From: woogerboy21 Date: Sat, 11 Jul 2015 16:35:12 -0400 Subject: [PATCH] Added -e option Added -e option by request Updated process checking method to allow -e option --- servatrice/scripts/db_backup_all | 4 ++-- servatrice/scripts/db_restore_all | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/servatrice/scripts/db_backup_all b/servatrice/scripts/db_backup_all index ce3433ab..35aa5d41 100644 --- a/servatrice/scripts/db_backup_all +++ b/servatrice/scripts/db_backup_all @@ -1,5 +1,6 @@ #!/bin/bash set -u +set -e SLEEPTIME=5 SQLCONFFILE="./mysql.cnf" #set this to the path that contains the mysql.cnf file LOGAPPENDDATE=`date +%m%d%Y` @@ -30,8 +31,7 @@ TABLES=( ) PROCESSNAME="mysqldump" -COMMANDRESULTS=`ps -e |grep $PROCESSNAME |grep -v grep` -if [ -z "$COMMANDRESULTS" ]; +if [ "$(pgrep $PROCESSNAME)" == "" ]; then [ ! -d $BACKUPDIR ] && mkdir -p $BACKUPDIR/ for TABLENAME in "${TABLES[@]}" diff --git a/servatrice/scripts/db_restore_all b/servatrice/scripts/db_restore_all index 7dcb4527..37d1f31e 100644 --- a/servatrice/scripts/db_restore_all +++ b/servatrice/scripts/db_restore_all @@ -1,5 +1,6 @@ #!/bin/bash set -u +set -e SLEEPTIME=5 SQLCONFFILE="./mysql.cnf" #set this to the path that contains the mysql.cnf file LOGAPPENDDATE=`date +%m%d%Y` @@ -30,8 +31,7 @@ TABLES=( ) PROCESSNAME="mysqldump" -COMMANDRESULTS=`ps -e |grep $PROCESSNAME |grep -v grep` -if [ -z "$COMMANDRESULTS" ]; +if [ "$(pgrep $PROCESSNAME)" == "" ]; then [ ! -d $BACKUPDIR ] && mkdir -p $BACKUPDIR/ for TABLENAME in "${TABLES[@]}"