summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-04-09 18:37:20 +0200
committerErich Eckner <git@eckner.net>2016-04-09 18:37:20 +0200
commitdd4311e6a8c7ae9330237875012356904be6a98c (patch)
tree3d9c7653e16ccb491dddb363d31dea7f25bf64d4
downloadlogwatch-extra-dd4311e6a8c7ae9330237875012356904be6a98c.tar.xz
initial commit: status quov0.0
-rwxr-xr-xdoalogwatch33
1 files changed, 33 insertions, 0 deletions
diff --git a/doalogwatch b/doalogwatch
new file mode 100755
index 0000000..4909fee
--- /dev/null
+++ b/doalogwatch
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+set -o pipefail
+
+abWannNaechstesMal="$(date +%F)"
+
+[ "${abWannNaechstesMal}" == "$(cat /etc/logwatch/letzteMeldung)" ] && 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 /etc/logwatch/letzteMeldung) and yesterday" || exit 2
+
+echo "${abWannNaechstesMal}" > /etc/logwatch/letzteMeldung
+
+rm -f ${warteAufFile} || exit 1