日志不断增加的解决?磁盘?sed?
研究下centos6.6的日志回滚!!!!========>
[root@localhost mysql3306]# ls /etc/cron.daily/
cups logrotate makewhatis.cron mlocate.cron prelink readahead.cron tmpwatch
<1>时间日志同步每天每分钟都需要同步,用日志回滚机制进行删除,定期保持一定的日志大小???
<2>软raid更换完坏盘后的swap分区如何处置?
d204 ~ # ls /dev/md2
ls: cannot access /dev/md2: No such file or directory
d204 ~ # ls /dev/md
md0 md1 md3
d204 ~ # fdisk -l |egrep "^/dev/sd*"
Disk /dev/md3 doesn't contain a valid partition table ??
Disk /dev/md1 doesn't contain a valid partition table
/dev/sda1 1 14 112423+ fd Linux raid autodetect
/dev/sda2 15 4192 33559785 82 Linux swap / Solaris
/dev/sda3 4193 8109 31463302+ fd Linux raid autodetect
/dev/sda4 8110 121601 911624490 83 Linux
/dev/sdb1 1 14 112423+ fd Linux raid autodetect
/dev/sdb2 15 4192 33559785 82 Linux swap / Solaris
/dev/sdb3 4193 8109 31463302+ fd Linux raid autodetect
/dev/sdb4 8110 121601 911624490 83 Linux
/dev/sdc1 1 14 112423+ fd Linux raid autodetect
/dev/sdc2 15 4192 33559785 82 Linux swap / Solaris
/dev/sdc3 4193 8109 31463302+ fd Linux raid autodetect
/dev/sdc4 8110 121601 911624490 83 Linux
/dev/sdd1 1 14 112423+ fd Linux raid autodetect
/dev/sdd2 15 4192 33559785 82 Linux swap / Solaris
/dev/sdd3 4193 8109 31463302+ fd Linux raid autodetect
/dev/sdd4 8110 121601 911624490 83 Linux
d202 ~ # ssh ${ip} sed -r '$d' /etc/nagios/nrpe.cfg
sed: -e expression #1, char 7: extra characters after command
参考一下的===>
1、最常见的s ——>替换字符串
$ sed 's/MA/Massachusetts/' list
——>找出MA并替换成Massachusetts,并列出内容(并不是在任何情况下都要将指令用单引号包围起来,但你应该养成这个习惯,如果不加单引号,那么你就可能会得到一个错误提示 sed: -e expression #1, char 2: unterminated `s' command
2、关闭自动输出,只打印被修改行 ——>这里用了参数-n(关闭自动输出)和p(打印被修改行)
$ sed -n -e 's/MA/Massachusetts/p' list
——>在命令行上编写多个语句时, 使用 ; 分隔或使用 -e
如:sed 's/ MA/, Massachusetts/; s/ PA/, Pennsylvania/' list
sed -e 's/ MA/, Massachusetts/' -e 's/ PA/, Pennsylvania/' list