test_backup - wrk version

This commit is contained in:
Mike D'Morto 2021-02-14 19:29:17 +07:00
parent 0c5c4c4415
commit bb0587f73e
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,3 @@
#test log and state file
UserParameter=test_backup[*],sudo /etc/zabbix/scripts/test_backup.sh $1

21
test_backup/test_backup.sh Executable file
View File

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