【笔记】树莓派ngrok客户端使用

3 篇文章 0 订阅
2 篇文章 0 订阅

首先获取ngrok,从自己的服务器生成下载。

cd /home/pi/
wget muumlover.com:8080/bin/linux_arm/ngrok

生成ngrok配置ngrok.cfg

touch ngrok.cfg
vim ngrok.cfg
server_addr: muumlover.com:4443
trust_host_root_certs: false

配置ngrok客户端启动

cd /etc/init.d/
touch ngrok
chmod +755 ngrok
vim ngrok

编辑启动脚本

#!/bin/bash
### BEGIN INIT INFO
# Provides:             ngrok
# Required-Start:
# Required-Stop:
# default-Start:        2 3 4 5
# default-Stop:         0 1 6
# Short-Description:    Start/Stop ngrok server
### END INIT INFO


do_start()
{
        cd /home/pi/
        nohup sudo ./ngrok -config ngrok.cfg -subdomain print 5000 &
        nohup sudo ./ngrok -config ngrok.cfg -subdomain wechat 8000 &
        nohup sudo ./ngrok -config ngrok.cfg -subdomain paper 8080 &
}
do_stop()
{
        ps -ef | grep ngrok | awk '{print $2}' | xargs kill -9
}

case "$1" in
    start)
        do_start
        ;;
    stop)
        do_stop
        ;;
    restart)
        do_stop
        do_start
        ;;
    *)
        ;;
esac

开启自启动服务

apt-get install chkconfig -y
sudo chkconfing ngrok on

chkconfing ngrok
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值