#!/bin/bash set -o pipefail abWannNaechstesMal="$(date +%F)" lmDatei="/var/cache/logwatch/letzteMeldung" [ "${abWannNaechstesMal}" == "$(cat "${lmDatei}")" ] && exit 0 warteAufFile="/home/shutdown/.warteauf/logwatch" touch ${warteAufFile} || exit 1 [ $(cat /proc/uptime | cut -d ' ' -f 1 | sed "s/\..*\$//") -gt 300 ] || exit 11 # check for currently running backups ps aux | grep -v "\sgrep\s" | grep -q "\s\(/usr/bin/\)\?backup\s" && exit 11 if [ -x /etc/backup.conf ] then . /etc/backup.conf for i in 1 2 do for id in "${!backups[@]}" do [ -e "/tmp/${id}.pid" ] && exit 11 done sleep 1 done fi logwatch --archives --range "between $(cat "${lmDatei}") and yesterday" || exit 2 echo "${abWannNaechstesMal}" > "${lmDatei}" rm -f ${warteAufFile} || exit 1