add status file

This commit is contained in:
2023-01-02 11:16:19 +01:00
parent 34ec5fce36
commit 18925b94cc

View File

@@ -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