寻觅生命中的那一片浅草......

每日存档 十一月 6th, 2009

MySQL不断restarted

平时用得好好的创建数据库的命令,突然间用不了了,今天把MySQL重启,发现无法启动,终端输出信息为
Starting mysqld daemon with databases from /usr/local/mysql/var
091104 12:28:16  mysqld restarted
/usr/local/mysql/bin/mysqld_safe: line 390:  7558 Killed                  nohup /usr/local/mysql/libexec/mysqld –basedir=/usr/local/mysql –datadir=/usr/local/mysql/var –user=mysql –pid-file=/usr/local/mysql/var/s1.1199.com.pid –skip-external-locking –port=3306 –socket=/tmp/mysql.sock >> /usr/local/mysql/var/s1.1199.com.err 2>&1

Number of processes running now: 0

ps aux |grep mysql
发现有如下进程
ps aux |grep mysql
root     23070  0.2  0.0  63824  1212 pts/1    S    12:19   0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe
mysql    26295  112  0.0      0     0 pts/1    Zl   12:22   0:01 [mysqld] <defunct>

cd /usr/local/mysql/var/
more s1.1199.com.err

发现错误如下
091104 12:19:29  mysqld started
/usr/local/mysql/libexec/mysqld: Error writing file ‘/usr/local/mysql/var/s1-slow.log’ (Errcode: 28)
091104 12:19:29 [ERROR] Could not use /usr/local/mysql/var/s1-slow.log for logging (error 28). Turning logging off for the whole dur
ation of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.
091104 12:19:30  InnoDB: Started; log sequence number 0 1511759772
091104 12:19:30 [ERROR] /usr/local/mysql/libexec/mysqld: Error writing file ‘/usr/local/mysql/var/s1.1199.com.pid’ (Errcode: 28)
091104 12:19:30 [ERROR] Can’t start server: can’t create PID file: No space left on device
df -h看了下
发现硬盘满了,删除掉多余文件,启动MySQL就可以了。

iptables v1.2.11: Unknown arg `–dport’

iptables -A RH-Firewall-1-INPUT -s 192.168.1.0/27 –dport 161 -j ACCEPT
iptables v1.2.11: Unknown arg `–dport’
Try `iptables -h’ or ‘iptables –help’ for more information.

改为这样就好了
iptables -A RH-Firewall-1-INPUT -p tcp -s 192.168.1.0/27 -m state –state NEW -m tcp –dport 161 -j ACCEPT

要在前面加 -p tcp

如何查找: 连续的多行内容

例如,我有一个文件包含这样的内容,我需要查找给变量abc和k连续赋值得语句(连续两句)

…..
abc=13               这里是符合条件的地方
k=12
…..

abc=5                 单独给abc赋值,不符合条件

…..
…..
abc=14               这个也是符合条件的地方
k=5
……

也就是说,如果我单独用两个grep来查找的话,肯定会得到很多不符合条件的结果。
如何才能达到前面我描述的需求呢? 也就是说,我希望的过滤结果像下面这样:
abc=13
k=12
abc=14
k=5
解答:

awk ‘/abc=/{s=$0;getline;if (/k=/) print s”\n”$0}’ file

sed -n ‘/abc=/{N;/k=/p}’ file

while read line
do
echo $line | grep -q k= && echo $pre | grep -q abc= && echo $pre && echo $line
pre=$line
done<file

来自:http://bbs3.chinaunix.net/viewthread.php?tid=1604893

2009年十一月
« 10月   12月 »
 1
2345678
9101112131415
16171819202122
23242526272829
30