V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
duolab
V2EX  ›  问与答

FRP 如何切到前台来?

  •  
  •   duolab · 2020-03-31 11:57:38 +08:00 · 1038 次点击
    这是一个创建于 1480 天前的主题,其中的信息可能已经有所发展或是发生改变。

    2020/03/31 09:11:41 [I] [service.go:157] frps tcp listen on 0.0.0.0:8000 2020/03/31 09:11:41 [I] [service.go:199] http service listen on 0.0.0.0:8080 2020/03/31 09:11:41 [I] [service.go:255] nat hole udp service listen on 0.0.0.0:7001

    比如运行了 ./frps -c ./frps.ini 会出现上面的东西,但是关掉了 ssh 客户端后,再连接服务器就不会显示了,想再次显示还得找到进程 kill -9 结束之,如何把这东西再切回来?谢谢

    5 条回复    2020-03-31 12:59:29 +08:00
    ThirdFlame
        1
    ThirdFlame  
       2020-03-31 12:00:10 +08:00
    `nohup ./frps -c ./frps.ini &`
    看同目录下的 nohup.out `tail -f nohup.out`
    noqwerty
        2
    noqwerty  
       2020-03-31 12:36:34 +08:00 via Android
    也可以 tmux 跑,或者 pm2 / supervisor 之类的程序监控
    jasonyang9
        3
    jasonyang9  
       2020-03-31 12:36:59 +08:00 via Android
    造一个 systemd 的服务单元吧,或者搜一下有现成的
    stille
        4
    stille  
       2020-03-31 12:44:02 +08:00
    用 systemd 控制吧,在 /lib/systemd/system 下创建 frps.service 修改下你自己的 frps 路径,然后 systemctl daemon-reload 生效.

    [Unit]
    Description=Frp Server Service
    After=network.target syslog.target
    Wants=network.target

    [Service]
    Type=simple
    Restart=on-failure
    RestartSec=5s
    ExecStart=/usr/local/frp/frps -c /usr/local/frp/frps.ini

    [Install]
    WantedBy=multi-user.target

    可以使用以下命令:
    sudo systemctl start frps
    sudo systemctl enable frps
    sudo systemctl status frps
    sudo systemctl restart frps
    sudo systemctl stop frps
    KasuganoSoras
        5
    KasuganoSoras  
       2020-03-31 12:59:29 +08:00
    用楼上说的 systemd 或者使用 screen
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1241 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 17:46 · PVG 01:46 · LAX 10:46 · JFK 13:46
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.