nov. 292011
 

Skript kustutab audit kataloogidest *.aud failid, skript asub /etc/cron.daily kataloogis:
#!/bin/bash
#Skript Oracle audit failide automaatseks kustutamiseks
DIR=`/usr/bin/find / -name audit -type d` #"audit" kataloogid
DIR1=`/usr/bin/find / -name adump -type d` #"audit" kataloogid
ATIME="+2" #faili vanus, millal viimati faili kasutati
ADMINID="admin@server admin2@server2" #kellele mail saata, eralda tühikuga
#leia failid "audit" kataloogides, pane kirja ja kustuta
/usr/bin/find $DIR $DIR1 -iname "*.aud" -type f -atime $ATIME -fprintf /opt/auditfailid '%p\n' -exec /bin/rm -f {} \;
#arvuta failide hulk ja saada info adminidele
echo -e "Kustutati `cat /opt/auditfailid|wc -l` *.aud faili serveris `hostname`.\n\nVaba ruumi on hetkel:\n`df -h|awk '{ print $4," " $6}'\n|egrep -v "Mounted|shm"`"|mail -s "Oracle audit failid" $ADMINID

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(vajalik)

(vajalik)

This site uses Akismet to reduce spam. Learn how your comment data is processed.