- 工信部备案号 滇ICP备05000110号-1
- 滇公安备案 滇53010302000111
- 增值电信业务经营许可证 B1.B2-20181647、滇B1.B2-20190004
- 云南互联网协会理事单位
- 安全联盟认证网站身份V标记
- 域名注册服务机构许可:滇D3-20230001
- 代理域名注册服务机构:新网数码
一台服务器运行一段时间后,系统就会产生各种各样的日志,而这些日志其实暴漏了系统的很多信息,这时候就需要定期清理使用痕迹
简单的清理脚本如下
#!/bin/bash cat /dev/null > /var/log/boot.log cat /dev/null > /var/log/btmp cat /dev/null > /var/log/cron cat /dev/null > /var/log/dmesg cat /dev/null > /var/log/firewalld cat /dev/null > /var/log/grubby cat /dev/null > /var/log/lastlog cat /dev/null > /var/log/mail.info cat /dev/null > /var/log/maillog cat /dev/null > /var/log/messages cat /dev/null > /var/log/secure cat /dev/null > /var/log/spooler cat /dev/null > /var/log/syslog cat /dev/null > /var/log/tallylog cat /dev/null > /var/log/wpa_supplicant.log cat /dev/null > /var/log/wtmp cat /dev/null > /var/log/yum.log cat /dev/null > /var/log/tuned/tuned.log rm -f /var/log/*-20* > /dev/null 2>&1 if [ -d "/var/log/anaconda/" ] ; then cat /dev/null > /var/log/anaconda/anaconda.log > /dev/null 2>&1 cat /dev/null > /var/log/anaconda/ifcfg.log > /dev/null 2>&1 cat /dev/null > /var/log/anaconda/journal.log > /dev/null 2>&1 cat /dev/null > /var/log/anaconda/packaging.log > /dev/null 2>&1 cat /dev/null > /var/log/anaconda/program.log > /dev/null 2>&1 cat /dev/null > /var/log/anaconda/storage.log > /dev/null 2>&1 cat /dev/null > /var/log/anaconda/syslog > /dev/null 2>&1 cat /dev/null > /var/log/anaconda/X.log > /dev/null 2>&1 fi if [ -d "/var/log/audit/" ] ; then rm -f /var/log/audit/audit.log* > /dev/null 2>&1 cat /dev/null > /var/log/audit/audit.log > /dev/null 2>&1 fi cat /dev/null > ~/.bash_history cat /dev/null > ~/.mysql_history cat /dev/null > ~/.viminfo
最后别忘了额外运行一次 history -c 清理自己的命令列表
售前咨询
售后咨询
备案咨询
二维码
TOP