1 |
On Wed, 2005-11-09 at 11:35 +0100, Harald Dumdey wrote: |
2 |
|
3 |
> Is there a 'solution' for that? Or do i have to write a shellscript... |
4 |
|
5 |
presumably a script dropped into /etc/cron.daily would do it. Along the |
6 |
lines of (nb: totally untested) ..? |
7 |
|
8 |
#!/bin/sh |
9 |
|
10 |
# mail address to send compressed logs to |
11 |
TO=your@×××××××××××.address |
12 |
|
13 |
# the hex ID of your GPG key |
14 |
KEY=0xaabbcc99 |
15 |
|
16 |
# which logs? *.0 will pick the most recently rotated set. You |
17 |
# can probably do better |
18 |
LOGS="/var/log/*.0" |
19 |
|
20 |
HOST=`cat /etc/conf.d/hostname` |
21 |
TODAY=`(date +"%y%m%d")` |
22 |
OUTFILE=/tmp/$HOST_$TODAY_logs.tbz2 |
23 |
|
24 |
# tar/compress |
25 |
tar cjf $OUTFILE |
26 |
|
27 |
# encrypt |
28 |
gpg -r $KEY --encrypt-files $OUTFILE |
29 |
|
30 |
# send. Not sure how you do this without mutt.. |
31 |
echo "Logs.." | mutt -s "$HOST logs for $TODAY" -a $OUTFILE.gpg $TO |
32 |
|
33 |
# clean up |
34 |
rm -f $OUTFILE $OUTFILE.gpg |
35 |
|
36 |
|
37 |
-- |
38 |
Darren Davison |
39 |
Public Key: 0xDD356B0D |