From 762c7ef47afd2f47499d8b5bfd15c81c023b32f6 Mon Sep 17 00:00:00 2001 From: Thomas Constans Date: Thu, 24 Nov 2022 22:14:03 +0100 Subject: [PATCH] check dir before writing status file --- ldap_backup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ldap_backup.sh b/ldap_backup.sh index f46a317..8eb671e 100644 --- a/ldap_backup.sh +++ b/ldap_backup.sh @@ -13,5 +13,5 @@ error=$? if [ $error -eq 0 ] ; then find $rdir -maxdepth 1 -type d -mtime +${rotate} -exec rm -fr {} \; fi -echo $error > $status_file +test -d $(dirname $status_file) && echo $error > $status_file exit $error