From d991b866b0beaa87f95764fcb537f92f5eb9f987 Mon Sep 17 00:00:00 2001 From: Thomas Constans Date: Fri, 16 Dec 2022 23:20:36 +0100 Subject: [PATCH] write status file only if parent dir exists --- mysql_backup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_backup.sh b/mysql_backup.sh index 8bc1e14..14fdce5 100755 --- a/mysql_backup.sh +++ b/mysql_backup.sh @@ -34,5 +34,5 @@ while read uh; do mysql --defaults-file=${defaultfile} -BNe "show grants for $uh if [ $error -eq 0 ] ; then find $rdir -maxdepth 1 -type d -mtime +${rotate} -exec rm -fr {} \; fi -echo $error > $status_file +test -d ${status_file%/*} && echo $error > $status_file exit $error