forked from evolix/evocheck
Add check_backupuptodate - Check that /home/backup is not older than 2 days
This commit is contained in:
parent
8eb2c5f9bc
commit
4798873ace
|
@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [6.7.4] - 2020-08-04
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Add check_backupuptodate - Check that /home/backup is not older than 2 days
|
||||||
|
|
||||||
## [6.7.3] - 2020-07-23
|
## [6.7.3] - 2020-07-23
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
24
evocheck.sh
24
evocheck.sh
|
@ -3,7 +3,7 @@
|
||||||
# EvoCheck
|
# EvoCheck
|
||||||
# Script to verify compliance of an OpenBSD server powered by Evolix
|
# Script to verify compliance of an OpenBSD server powered by Evolix
|
||||||
|
|
||||||
readonly VERSION="6.7.3"
|
readonly VERSION="6.7.4"
|
||||||
|
|
||||||
# Disable LANG*
|
# Disable LANG*
|
||||||
|
|
||||||
|
@ -139,7 +139,25 @@ check_uptime(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_backuptodate(){
|
check_backupuptodate(){
|
||||||
|
backup_dir="/home/backup"
|
||||||
|
if [ -d "${backup_dir}" ]; then
|
||||||
|
if [ -n "$(ls -A ${backup_dir})" ]; then
|
||||||
|
for file in ${backup_dir}/*; do
|
||||||
|
let "limit = $(date +"%s") - 172800"
|
||||||
|
updated_at=$(stat -f "%m" "$file")
|
||||||
|
|
||||||
|
if [ -f "$file" ] && [ "$limit" -gt "$updated_at" ]; then
|
||||||
|
failed "IS_BACKUPUPTODATE" "$file has not been backed up"
|
||||||
|
test "${VERBOSE}" = 1 || break;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
failed "IS_BACKUPUPTODATE" "${backup_dir}/ is empty"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
failed "IS_BACKUPUPTODATE" "${backup_dir}/ is missing"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_gitperms(){
|
check_gitperms(){
|
||||||
|
@ -333,7 +351,7 @@ main() {
|
||||||
test "${IS_EVOBACKUP:=1}" = 1 && check_evobackup
|
test "${IS_EVOBACKUP:=1}" = 1 && check_evobackup
|
||||||
test "${IS_UPTODATE:=1}" = 1 && check_uptodate
|
test "${IS_UPTODATE:=1}" = 1 && check_uptodate
|
||||||
test "${IS_UPTIME:=1}" = 1 && check_uptime
|
test "${IS_UPTIME:=1}" = 1 && check_uptime
|
||||||
test "${IS_BACKUPUPTODATE:=1}" = 1 && check_backuptodate
|
test "${IS_BACKUPUPTODATE:=1}" = 1 && check_backupuptodate
|
||||||
test "${IS_GITPERMS:=1}" = 1 && check_gitperms
|
test "${IS_GITPERMS:=1}" = 1 && check_gitperms
|
||||||
test "${IS_ADVBASE:=1}" = 1 && check_advbase
|
test "${IS_ADVBASE:=1}" = 1 && check_advbase
|
||||||
test "${IS_PREEMPT:=1}" = 1 && check_preempt
|
test "${IS_PREEMPT:=1}" = 1 && check_preempt
|
||||||
|
|
Loading…
Reference in a new issue