你好,游客 登录 注册 搜索
背景:
阅读新闻

Shell Script - enable goagent proxy for vmnet8 - t0nsha's Blog

[日期:2013-03-16] 来源:  作者: [字体: ]

通过本地SSH转发为vmware虚拟机开启goagent代理的一段脚本:

#!/bin/bash
# filename: p4vmnat
# description: enable goagent proxy for vmnet8 
# login into 127 22, forward 172 8087 to 127 8087
# ssh -L 172.16.172.1:8087:127.0.0.1:8087 127.0.0.1 -Nf

ssh_cmd='ssh -L 172.16.172.1:8087:127.0.0.1:8087 127.0.0.1 -Nf'
# echo "${ssh_cmd}"
for pid in $(pgrep -f "${ssh_cmd}")
do
  echo $pid
  kill -9 $pid 2>/dev/null
done
# expr "${ssh_cmd}" # expr won't prompt us to input passwd
eval "${ssh_cmd}"






收藏 推荐 打印 | 录入:admin | 阅读:
相关新闻