mirror of
https://github.com/vincenthsu/systemd-ngrok.git
synced 2025-05-12 12:41:32 +00:00
Merge 1b0360c0ed
into 71a52012ce
This commit is contained in:
commit
88e83fbeb2
71
install.sh
71
install.sh
|
@ -1,5 +1,35 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if (( $EUID != 0 )); then
|
||||||
|
echo "Please run as root"
|
||||||
|
echo "You can Try comand 'su root' or 'sudo -i' or 'sudo -'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo apt-get update
|
||||||
|
|
||||||
|
if [ ! $(which wget) ]; then
|
||||||
|
sudo apt-get install wget -y
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! $(which jq) ]; then
|
||||||
|
sudo apt-get install jq -y
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! $(which git) ]; then
|
||||||
|
sudo apt-get install git -y
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "./install.sh <your_authtoken>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e ngrok.service ]; then
|
||||||
|
git clone --depth=1 https://github.com/vincenthsu/systemd-ngrok.git
|
||||||
|
cd systemd-ngrok
|
||||||
|
fi
|
||||||
|
|
||||||
# determine system arch
|
# determine system arch
|
||||||
ARCH=
|
ARCH=
|
||||||
if [ "$(uname -m)" == 'x86_64' ]
|
if [ "$(uname -m)" == 'x86_64' ]
|
||||||
|
@ -15,39 +45,9 @@ else
|
||||||
ARCH=arm
|
ARCH=arm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ARCHIVE=ngrok-v3-stable-linux-$ARCH.zip
|
ARCHIVE=ngrok-v3-stable-linux-$ARCH.tgz
|
||||||
DOWNLOAD_URL=https://bin.equinox.io/c/bNyj1mQVY4c/$ARCHIVE
|
DOWNLOAD_URL=https://bin.equinox.io/c/bNyj1mQVY4c/$ARCHIVE
|
||||||
|
|
||||||
if [ ! $(which wget) ]; then
|
|
||||||
echo 'Please install wget package'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! $(which git) ]; then
|
|
||||||
echo 'Please install git package'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! $(which unzip) ]; then
|
|
||||||
echo 'Please install zip package'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if (( $EUID != 0 )); then
|
|
||||||
echo "Please run as root"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
echo "./install.sh <your_authtoken>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e ngrok.service ]; then
|
|
||||||
git clone --depth=1 https://github.com/vincenthsu/systemd-ngrok.git
|
|
||||||
cd systemd-ngrok
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp ngrok.service /lib/systemd/system/
|
cp ngrok.service /lib/systemd/system/
|
||||||
mkdir -p /opt/ngrok
|
mkdir -p /opt/ngrok
|
||||||
cp ngrok.yml /opt/ngrok
|
cp ngrok.yml /opt/ngrok
|
||||||
|
@ -55,13 +55,18 @@ sed -i "s/<add_your_token_here>/$1/g" /opt/ngrok/ngrok.yml
|
||||||
|
|
||||||
cd /opt/ngrok
|
cd /opt/ngrok
|
||||||
echo "Downloading ngrok for $ARCH . . ."
|
echo "Downloading ngrok for $ARCH . . ."
|
||||||
wget $DOWNLOAD_URL
|
wget $DOWNLOAD_URL --no-check-certificate
|
||||||
unzip $ARCHIVE
|
tar xvf $ARCHIVE
|
||||||
rm $ARCHIVE
|
rm $ARCHIVE
|
||||||
chmod +x ngrok
|
chmod +x ngrok
|
||||||
|
|
||||||
systemctl enable ngrok.service
|
systemctl enable ngrok.service
|
||||||
systemctl start ngrok.service
|
systemctl start ngrok.service
|
||||||
|
systemctl status ngrok.service
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
STATUSNGROK=$(wget http://127.0.0.1:4040/api/tunnels -q -O - | jq '.tunnels | .[] | "\(.name) \(.public_url)"')
|
||||||
|
echo -e "service online NGROK:\n" $STATUSNGROK
|
||||||
|
|
||||||
echo "Done installing ngrok"
|
echo "Done installing ngrok"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user