blob: 5813071ecff35619c4019d9334d71267c1a33659 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#!/bin/bash
# doalogwatch, part of logwatch-extra version #VERSION#
set -e
abWannNaechstesMal="$(date +%F)"
lmDatei="#CACHEDIR#/logwatch/letzteMeldung"
warteAufFile="#WAITDIR#/logwatch"
[ ! -r "${lmDatei}" ] && \
echo '1970-01-01' > "${lmDatei}"
[ "${abWannNaechstesMal}" == "$(cat "${lmDatei}")" ] && \
exit 0
[ -r "${warteAufFile}" ] && \
ps aux | \
grep -q "^\S\+\s\+$(cat "${warteAufFile}")\s" && \
exit 0
echo $$ > "${warteAufFile}"
[ -r #ETCDIR#/backup.conf ] && \
. #ETCDIR#/backup.conf
warten=true
until ! ${warten}
do
warten=false
[ $(cat /proc/uptime | cut -d ' ' -f 1 | sed "s/\..*\$//") -le 300 ] && \
warten=true
# check for currently running backups
ps aux | \
grep -v "\sgrep\s" | \
grep -q "\s\(#BINDIR#/\)\?backup\s" && \
warten=true
if [ -r #ETCDIR#/backup.conf ]
then
for i in 1 2
do
for id in "${!backups[@]}"
do
[ -e "#TMPDIR#/${id}.pid" ] && \
warten=true
done
sleep 1
done
fi
done
logwatch --archives --range "between $(cat "${lmDatei}") and yesterday"
echo "${abWannNaechstesMal}" > "${lmDatei}"
rm -f ${warteAufFile}
|