找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 2717|回复: 2

padavan autossh不能正常工作

[复制链接]
发表于 2017-1-5 08:59 | 显示全部楼层 |阅读模式
padavan装opkg后,安装的autossh不能正常运行。总是报错。单独用ssh命令可以,但无法实现断开后自动重连。各位有试过的吗?主要是要实现动态端口转发。
我的恩山、我的无线 The best wifi forum is right here.
 楼主| 发表于 2017-1-5 10:55 | 显示全部楼层
有没有大佬开始个能自动重四连ssh的脚本。从网上下了个,不能工作
用shell脚本自动监控,一旦发现链接断掉,就自动重新链接:
function make_proxy() {
    PROXY_ID=$(pgrep -f "ssh -D port user@host")

    if [[ $PROXY_ID != 0 ]];then
        ssh -D port user@host ;
    fi
}

function test_proxy() {
    curl -s -I --socks5 localhost:7972 http://www.yahoo.com/ > /dev/null;
}

SHORT=5
LONG=300
count=0

while true; do
    test_proxy;
    if [[ $? != 0 ]];then
        make_proxy;
        duration=$SHORT;
        ((count++));
    else
        count=0;
        duration=$LONG;
    fi
    if [[ $count == 5 ]];then
        notify-send -t 3000 -u critical "roxy Failed" "Couldn't connect to proxy";
        exit -1;
    fi
    sleep $duration;
don
这个脚本就是每300秒通过ssh tunnel链接一下yahoo,测试是否成功,如果不成功就认为ssh链接已经断开,会自动尝试ssh链接5次,如果全部失败,就发送信息。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2017-10-6 10:01 | 显示全部楼层
autossh在openwrt路由器运行是个坑。
替代品sshtunnel的参数教程也有bug
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-3-29 14:55

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表