From 18925b94cce657df14ab46521482cdf96ba50204 Mon Sep 17 00:00:00 2001 From: Thomas Constans Date: Mon, 2 Jan 2023 11:16:19 +0100 Subject: [PATCH] add status file --- mongodb_backup.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mongodb_backup.sh b/mongodb_backup.sh index f8b7669..dc55977 100755 --- a/mongodb_backup.sh +++ b/mongodb_backup.sh @@ -5,6 +5,7 @@ rotate=15 rdir=${1:-/root/backups/mongodb} dir=${rdir}/$(date "+%Y.%m.%d") + status_file=/var/run/zabbix/backup_mongodb.status error=0 mkdir -p $dir cd $dir @@ -14,5 +15,6 @@ error=$? if [ $error -eq 0 ] ; then find $rdir -maxdepth 1 -type d -mtime +${rotate} -exec rm -fr {} \; fi +test -d ${status_file%/*} && echo $error > $status_file exit $error