From bb0587f73e96a304968c352ecf52fc5bc7db2af0 Mon Sep 17 00:00:00 2001 From: Mike D'Morto Date: Sun, 14 Feb 2021 19:29:17 +0700 Subject: [PATCH] test_backup - wrk version --- test_backup/test_backup.conf | 3 +++ test_backup/test_backup.sh | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 test_backup/test_backup.conf create mode 100755 test_backup/test_backup.sh diff --git a/test_backup/test_backup.conf b/test_backup/test_backup.conf new file mode 100644 index 0000000..8d858cc --- /dev/null +++ b/test_backup/test_backup.conf @@ -0,0 +1,3 @@ +#test log and state file +UserParameter=test_backup[*],sudo /etc/zabbix/scripts/test_backup.sh $1 + diff --git a/test_backup/test_backup.sh b/test_backup/test_backup.sh new file mode 100755 index 0000000..e72d04d --- /dev/null +++ b/test_backup/test_backup.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +case $1 in + log) + STATUS=$(tail -n 2 /var/log/backup.log | head -n 1 | grep $(date +%Y-%m-%d) | cut -f 3 -d " ") + if [[ $STATUS == "SUCCESS_BACKUP" ]] + then echo "1"; + else echo "0"; + fi + ;; + state) + test -f /var/tmp/backuper.state + if [[ $? == "0" ]] + then + cat /var/tmp/backuper.state + else + echo "none" + fi + ;; +esac +