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