shell脚本绑定网关
#!/bin/env bash
gw1=172.16.53.254
gw2=172.16.52.254
##this is Automatic binding gateway scripts
####author xw 2018.3.27
while :
do
ip route del default
ip route add default via...
使用Shell脚本修改服务器密码
实现思路:先定义主机ip文件,然后用ping测试,如果主机能通,则修改密码,如果成功则记录到Success.txt,如果修改失败,则记录到fail.txt,如果主机down,则记录到down.txt,前提是配置好公钥和做ssh远程连接优化后#!/bin/env bash
##this is modify scripts
####author xw 2018.3.27
read -p &qu...
shell 使用ssh远程服务器执行命令
#!/bin/env bash
##this is ssh_config scripts
##author xw 2018.3.26
for ip in `cat passwd.txt` ##这个文件定义为那些主机做命令
do
{
ssh $ip "sed -ri '/^#UseDNS/c\UseDNS no' /etc/ssh/s...
shell脚本批量推送公钥实现免密码登录
2018-03-26 14:45:56 星期一实现基本思路,先检测局域网有多少台存活服务器,然后将密钥批量推送#!/bin/env bash
##this is Public Key Push script
##author xw 2018.3.26
>passwd.txt
Passwd=p0-p0-p0- ##定义所有被推送服务器统一的密码
rpm -q expect &&...
使用shell脚本配合jumpserver自动登录服务器
1.生产服务器的ssh一定是不允许通过客户端直接连接服务器的,需中间加一个jumpserver做堡垒机,一般是客户端通过vpn(openvpn等)首先拨号连接jumpserver。2.写一个shell脚本(非常简单)#!/bin/env bash
##this is user automatic logon scipts
##author xw 2018.3.23
trap "&q...