Skip to content

Instantly share code, notes, and snippets.

@mendesbarreto
Created February 11, 2017 18:52
Show Gist options
  • Save mendesbarreto/84501fe57c4e4ee7f75de1aa012fd50d to your computer and use it in GitHub Desktop.
Save mendesbarreto/84501fe57c4e4ee7f75de1aa012fd50d to your computer and use it in GitHub Desktop.
Script to start Ngrok at raspberry every boot
#! /bin/sh
# /etc/init.d/ngrok
case "$1" in
start)
echo "Ngrok service is starting"
screen ./ngrok start -all -config /home/pi/.ngrok2/ngrok.yml
echo "Ngrok service was started"
;;
stop)
echo "Ngrok is stopping"
killall ngrok
echo "Service ngrok was stopped"
;;
*)
echo "Usage: /etc/init.d/ngrok.sh {start|stop}"
exit 1
;;
esac
exit 0
@alana314
Copy link

Thanks for this! I got 'must be connected to a terminal' errors with screen until I changed the screen line to be detached:
screen -d -m /usr/local/bin/ngrok start -all -config /home/pi/.ngrok2/ngrok.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment