Created
November 7, 2017 06:30
-
-
Save ardyantohermawan/04f3f79b17399949e24e18c653595902 to your computer and use it in GitHub Desktop.
Ngrok Service Ubuntu 16.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# download | |
wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip | |
# unzip | |
unzip ngrok-stable-linux-amd64.zip | |
# move to /usr/local/bin | |
sudo mv ngrok /usr/local/bin | |
# create directory | |
sudo mkdir -p /opt/ngrok/systemd/system/ | |
# export authtoken | |
export TOKEN="authtoken from dashboard" | |
# create config file | |
echo "authtoken: $TOKEN" | sudo tee /opt/ngrok/ngrok.yml | |
# create systemd script | |
echo "[Unit] | |
Description=ngrok script | |
[Service] | |
ExecStart=/usr/local/bin/ngrok tcp --region=ap --config=/opt/ngrok/ngrok.yml 22 | |
Restart=always | |
[Install] | |
WantedBy=multi-user.target" | sudo tee /opt/ngrok/systemd/system/ngrok.service | |
# copy systemd script | |
sudo cp /opt/ngrok/systemd/system/ngrok.service /etc/systemd/system/ngrok.service | |
# reload daemon | |
sudo systemctl daemon-reload | |
# enable service | |
sudo systemctl enable ngrok.service | |
# start service | |
sudo systemctl start ngrok.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment