建立服务启动文档:
vim /etc/init.d/ngrok
#!/bin/sh
### BEGIN INIT INFO
# Provides: ngrok
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start or stop the ngrok Proxy.
### END INIT INFO
ngrok_path=/root/ngrok/
case "$1" in
start)
echo "start ngrok service.."
sh ${ngrok_path}/ngrok.sh &
;;
*)
exit 1
;;
esac
设置启动:
systemctl enable ngrok
systemctl start ngrok
reboot
然后测试一下。就OK了