Shell脚本自动更新hosts实现免翻墙访问google
上次给大家发了一个python更新google hosts的脚本,今天看到有人发出了一句用shell来获取google hosts的脚本,我就拿来稍微简单加工了下,下面给大家shell版的更新google hosts的脚本。
脚本内容:
cat google_update.sh #!/bin/bash data=`date +%y%m%d%H%M` curl http://www.360kb.com/kb/2_122.html 2>/dev/null | sed -n '/#google-hosts-2015/,/#google-hosts-2015-end/{s/ //g; s/<.*>//g; p}' >/tmp/hosts cp /etc/hosts /etc/hosts_$data.bak mv /tmp/hosts /etc/hosts cat>>/etc/hosts<<EOF 127.0.0.1 testbak localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 EOF
也一样丢到crontab里,每隔3天更新一次
0 0 */3 * * /bin/sh /root/soft_shell/google_update.sh
Shell脚本实现非法IP登陆自动报警
服务器的安全稳定是每个运维都希望达到的目标,毕竟网站一旦流量大了,访问高了,就会有一些无聊人来攻击,帮忙检测漏洞是好,但纯ddos的性质就很恶劣
Shell脚本遍历目录并批量修改文件编码
在将windows上的jsp网页移植到linux环境中时,发现一个个的转换编码及修改默认编码类型太慢,写此脚本进行尝试文件遍历~好久不写,手生了。#!/bin/bash##
Shell脚本查看进程内存真实占用情况
#!/bin/bash#****************************************************************##ScriptName:pm#Author:osdba#CreateDate:2010-01-31#ModifyAuthor:#ModifyDate:2010-01-31#Function:showprocessesmemoryused#****
标签:脚本,遍历,给大家,我就,文件