diff --git a/seqs/mysql.sh b/seqs/mysql.sh index fbf8a07..63497c0 100755 --- a/seqs/mysql.sh +++ b/seqs/mysql.sh @@ -302,12 +302,14 @@ step_50() { fi local dbName="$1" local buTarget="$2" - if [ -z $2 ] ; then + if [ -z "$2" ] ; then echoerr " [W] No target directory provided. Using home of current user" - buTarget="~" + buTarget="$HOME" + elif [ ! -e "$2" ]; then + endReturn -o 1 -f "$2 does not exist" fi - echo " [I] Dumping database $dbName to $(realpath $buTarget)" + echo " [I] Dumping database $dbName to $buTarget" exep "mysqldump --single-transaction $dbName > \"$(realpath $buTarget)/${dbName}_backup_$(date +%Y%m%d-%H%M%S).sql\"" endReturn -o $? "Error creating $dbName backup" }