Created
March 3, 2021 09:42
-
-
Save romech/8b83268524cf5853e9b81daf2c3cb05b to your computer and use it in GitHub Desktop.
Check that ngrok is running. If not, try to restart. Return tunnel urls.
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 | |
resp=$(curl -sS http://127.0.0.1:4040/api/tunnels || echo 0) | |
if [[ $resp == "0" ]]; then | |
echo "Restarting service" >&2 | |
pkill ngrok | |
screen -dmS ngrok /home/human/ngrok start --all | |
sleep 90 | |
resp=$(curl -sS http://127.0.0.1:4040/api/tunnels) | |
fi | |
tunnel=$(jq '.tunnels[].public_url' <<< "$resp") | |
if [[ "$tunnel" == "null" ]]; then | |
echo "nil" | |
else | |
echo $tunnel | |
fi |
MejahMesh256
commented
Jun 2, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment