這個有點麻煩,因為種種原因還沒有自動化,先把小抄寫在這裡
su root
####處理 Web log
cd /var/log/httpd
gzip access_log error_log ssl_request_log
mv access_log.gz access_log.200210-12.gz
mv ssl_engine_log.gz ssl_request_log.200210-12.gz
mv error_log.gz error_log.200210-12.gz
rm -rf 舊的log與目錄
scp *gz tech:/backup/data/log/SERVERNAME
####處理系統log
cd /var/log
gzip messages* maillog* secure* xferlog* wtmp* rpmpkgs* bind* boot* btmp* \
lastlog procmail* sudo* up2date* spooler* cron* ksyms* netconf* amavis* \
mysqld* openwebmail* prelink.log* yum* xferlog* freshclam* anaconda*
touch lastlog wtmp bind.log prelink.log freshclam.log amavis.log
chown root.clamav freshclam.log
chown amavis.amavis amavis.log
chmod 661 freshclam.log
chown named.named bind.log
/etc/rc.d/init.d/named restart
/etc/rc.d/init.d/syslog restart
/etc/init.d/amavisd restart
tar zcvf bind.tgz /var/named/chroot/var/log/named named
tar zcvf audit.tgz audit
tar zcvf icecast.tgz icecast
tar zcvf sa.tgz sa
tar zcvf mailman.tgz mailman
tar zcvf samba.tgz samba
scp *gz tech:/backup/data/log/SERVERNAME
####看情況殺掉舊log
rm -rf *.gz
rm -rf *.tgz
rm -rf icecast/*
rm -rf sa/*
rm -rf audit/*
###### 因為BBS已經關了,所以底下都不用做了。20080401
######如果是bbs還要處理另外的log
cd /home/bbs/adm
scp * tech:/backup/data/log/bbs/bbslog
rm -rf *
##### bbs還要處理BBS舊文章
cd /home/bbs/archive
gzip *
scp * tech:/backup/data/log/bbs/article
rm -rf *
閱讀全文 log備份機制 →