Linux系统中部署JDK环境

1、查看jdk是否安装 使用命令rpm -qa|grep jdk或java -version 2、下载到/usr/local目录 [root@192 local]# wget –no-check-certificate –no-cookie –header “Cookie: oraclelicense=accept-securebackup-cookie;” http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be…

ssh登陆

#/usr/bin/python #coding:utf8 import pxssh import getpass try: s = pxssh.pxssh() hostname = raw_input(‘hostname: ‘) username = raw_input(‘username: ‘) password = getpass.getpass(‘please input password: ‘) s.login (hostname,username,password) s.sendli…

通过ipset+iptables封堵异常连接IP

如果同一个IP异常连接超过某个值,就将该IP加入黑名单,180S后释放该IP #!/bin/bash ipset create blacklist hash:ip timeout 180 iplist=`netstat -ntu | awk ‘{print $5}’| cut -d’:’ -f1| sort |uniq -c | sed ‘N;$d;P;D’ | awk ‘{if($1>30)print $2}’` for ip in $iplist do # iptables -I IN…

SFTP上传文件

通过远程链接到服务器,将备份文件的脚本传送过去,然后更新文件 #!/bin/bash #set -x #wang_chongsheng@163.com 2017-08-25 dir=${DIR} host=”” port=32837 user=”root” date=$(date +%Y%m%d-%H) while getopts ‘d:h:p:u:’ opt ; do case $opt in d) dir=”$OPTARG”;; h) host=”$OPTARG”;; u) user=”$O…

文件的更新和备份

通过脚本中的find查找需要备份或更新的路径,执行文件备份 #!/bin/bash #uset -x #wang_chongsheng@163.com #2017-08-25 backup_dir=${B_DIR} update_dir=”” date=”$(date +”%Y%m%d%H”)” while getopts ‘b:u:’ opt ; do case $opt in b) backup_dir=”$OPTARG”;; u) update_dir=”$OPTARG”;; *) ech…

JDK8以及MySQL二进制包下载

#/bin/bash # #wang_chongsheng@163.com ##2017-10-30 ##JDK&&MySQL下载 Dpath=’/opt/install/src’ echo 应用编号: echo 1.jdk-8u152-linux-x64.tar.gz echo 2.mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz echo 3.jdk and MySQL echo read -p “input a val:” val if […

批量解析域名IP

#/bin/bash for i in `cat http.txt`;do dig @114.114.114.114 $i |awk ‘/cn|com/’|awk ‘{print$5}’ |grep 1 >> http_filter.txt dig @8.8.8.8 $i |awk ‘/cn|com/’|awk ‘{print$5}’ |grep 1 >> http_filter.txt done