mirror of
https://github.com/phfroidmont/self-hosting.git
synced 2025-12-25 13:46:59 +01:00
Add alert when backup takes a long time
This commit is contained in:
parent
f318e42f8c
commit
f778bfb44e
4 changed files with 29 additions and 2 deletions
17
roles/monit/files/checkBackupStatus.sh
Executable file
17
roles/monit/files/checkBackupStatus.sh
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
ONGOING_FILE="/backups/backup-ongoing"
|
||||
|
||||
if [ -f "$ONGOING_FILE" ]
|
||||
then
|
||||
if test `find "$ONGOING_FILE" -mmin +1`
|
||||
then
|
||||
LAST_MODIFICATION_HOURS=`expr "$(($(date +%s) - $(date +%s -r $ONGOING_FILE)))" / 3600`
|
||||
echo "Backup not finished after more than $LAST_MODIFICATION_HOURS hours"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Loading…
Add table
Add a link
Reference in a new issue