diff options
author | Erich Eckner <git@eckner.net> | 2016-05-04 12:45:02 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2016-05-04 12:45:02 +0200 |
commit | eec14ee06c14329cd8eefa6eedb7e7dd0ca3cc9c (patch) | |
tree | 18e06dcb65383c73e7d153d5348d1c585fffd10d /doalogwatch.in | |
parent | 398ea4ed3df305c2e7b9ce7c951f5165bd664627 (diff) | |
download | logwatch-extra-eec14ee06c14329cd8eefa6eedb7e7dd0ca3cc9c.tar.xz |
Makefile neu, Versionsupdatev0.2
Diffstat (limited to 'doalogwatch.in')
-rwxr-xr-x | doalogwatch.in | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/doalogwatch.in b/doalogwatch.in new file mode 100755 index 0000000..c479cbf --- /dev/null +++ b/doalogwatch.in @@ -0,0 +1,34 @@ +#!/bin/bash + +# doalogwatch, part of logwatch-extra version #VERSION# + +abWannNaechstesMal="$(date +%F)" +lmDatei="#CACHEDIR#/logwatch/letzteMeldung" + +[ "${abWannNaechstesMal}" == "$(cat "${lmDatei}")" ] && exit 0 + +warteAufFile="#WAITDIR#/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\(#BINDIR#/\)\?backup\s" && exit 11 +if [ -x #ETCDIR#/backup.conf ] +then + . #ETCDIR#/backup.conf + for i in 1 2 + do + for id in "${!backups[@]}" + do + [ -e "#TMPDIR#/${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 |