Hunter的大杂烩 技术学习笔记

2014-12-15

SuseLinux ganglia 图片出错处理

Filed under: 技术话题 — hunter @ 4:52 pm

apache error_log文件中

1.  出现:sh: /usr/bin/rrdtool: No such file or directory
修改  conf_default.php,

$conf[‘rrdtool’] = “/usr/local/rrdtool/bin/rrdtool”;

2. 出现:

(process:4017): Pango-CRITICAL **: No fonts found:
This probably means that the fontconfig
library is not correctly configured. You may need to
(more…)

2014-12-09

获取百度查询结果的真实链接脚本

Filed under: 技术话题 — hunter @ 2:56 pm

#!/bin/sh

page=0

echo > 3.txt

for (( page = 0; page < 70; page=page+10)) do urlStr="http://www.baidu.com/s?wd=keyword%20site%3Aicaifu.com&pn=”$page”&rsv_spt=1&issp=1&f=8&rsv_bp=0&rsv_idx=2&ie=utf-8″

(more…)

bash shell script sample

Filed under: 技术话题 — hunter @ 2:54 pm

用来提取sql中的两个变量值

sql:UPDATE XXXX SET `SEQ` = ‘123456’, yyy=’xxx’ where SEQ = 123457
#!/bin/sh

int_regex=([0-9]+)

grep UPDATE pg.sql |grep HK_SAKCHMJSHH|while read line
do
first_seq_pos=`echo $line|awk ‘{print index($0,”x60SEQx60 = x27″)}’`
second_seq_pos=`echo $line|awk ‘{print index($0, “SEQ = “)}’`

if [ $first_seq_pos -ne $second_seq_pos ];then
((first_seq_pos=$first_seq_pos+9))
((second_seq_pos=$second_seq_pos+6))
first_seq=`echo $line |awk -v pos=”$first_seq_pos” ‘{print substr($0, pos, 8) }’`
second_seq=`echo $line |awk -v pos=”$second_seq_pos” ‘{print substr($0, pos, 8) }’`
echo $first_seq
if [[ $first_seq =~ ([0-9]+) ]];then
echo “match:”${BASH_REMATCH[1]}
fi
echo $second_seq
exit
fi

done

Powered by WordPress