<filename>nat/nat_squid_restart_utils.py<gh_stars>1-10
#!-*- coding:utf-8 -*-
"""
远程重启squid
"""
import re
s = """192.168.3.11:9000   qing
172.16.31.10:9000 qing
"""
pattern = r'(?:\d{1,3}\.){3}\d{1,3}'
proxy_list =  re.findall(pattern, s)

restart_squid_command = "systemctl restart squid; ps aux | grep squid"      # 重启squid服务
restart_proxy_manager_command = 'service NetworkManager restart;  ps -aux | sort -k4nr | head -1;'   # 重启远程服务，查看内存占用top1进程
command = restart_proxy_manager_command
for ip_port in proxy_list:
    print 'ssh root@%s "%s"; sleep 2;' %(ip_port, command)




<filename>nat/nat_squid_restart_utils.py<gh_stars>1-10
#!-*- coding:utf-8 -*-
"""
远程重启squid
"""
import re
s = """192.168.3.11:9000   qing
172.16.31.10:9000 qing
"""
pattern = r'(?:\d{1,3}\.){3}\d{1,3}'
proxy_list =  re.findall(pattern, s)

restart_squid_command = "systemctl restart squid; ps aux | grep squid"      # 重启squid服务
restart_proxy_manager_command = 'service NetworkManager restart;  ps -aux | sort -k4nr | head -1;'   # 重启远程服务，查看内存占用top1进程
command = restart_proxy_manager_command
for ip_port in proxy_list:
    print 'ssh root@%s "%s"; sleep 2;' %(ip_port, command)




#!-*- coding:utf-8 -*- 远程重启squid 192.168.3.11:9000   qing 172.16.31.10:9000 qing # 重启squid服务 # 重启远程服务，查看内存占用top1进程