- 论坛徽章:
- 0
|
/var/log/下面 的日志
比如 secure ,wtmp 都会产生 secure.1 secure.2 ... secure.7 wtmp.1 wtmp.2 ... wtmp.7 这样的文件
怎么来批量清空日志?- #!/bin/sh
- if [ -a /var/log/secure ] ; then
- echo > /var/log/secure ;
- elif [ -a /var/log/secure.1 ] ; then
- echo > /var/log/secure.1 ;
- elif [ -a /var/log/secure.2 ] ; then
- echo > /var/log/secure.2 ;
- elif [ -a /var/log/secure.3 ] ; then
- echo > /var/log/secure.3 ;
- elif [ -a /var/log/secure.4 ] ; then
- echo > /var/log/secure.4 ;
- elif [ -a /var/log/secure.5 ] ; then
- echo > /var/log/secure.5 ;
- elif [ -a /var/log/secure.6 ] ; then
- echo > /var/log/secure.6 ;
- elif [ -a /var/log/secure.7 ] ; then
- echo > /var/log/secure.7
- fi
复制代码 我这笨方法没用诶。。。。
高手求助 |
|