-
-
Save spdrman/60d2d0f32225783ba4f995725e551828 to your computer and use it in GitHub Desktop.
Openvpn Scheduler
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 | |
################################################ | |
# A SIMPLE SCHEDULE IP CHANGE SCRIPT FOR LINUX # | |
# MAKE SURE YOU HAVE RUN hma-udp-grabber.sh # | |
################################################ | |
OPENVPNCONFIG_PATH="/etc/openvpn" | |
while true | |
do | |
#openvpn --daemon --config ${OPENVPNCONFIG_PATH}/Afghanistan.Kabul.TCP.ovpn # <<<< change the config file string to match your prefered server | |
openvpn --daemon --config ${OPENVPNCONFIG_PATH}/USA.Seattle.TCP.ovpn | |
echo "#####################" | |
echo "Press CTRL+C to stop." | |
echo "#####################" | |
sleep 60 # <<<< wait for connection to be established | |
# do something here | |
killall openvpn # <<<< disconnect | |
sleep 30 # <<<< wait a bit more to make sure that the openvpn has been properly disconnected | |
done | |
# ----------- NOTE ----------- # | |
# IT'S NOT ADVISABLE TO SWITCH THE IP FASTER THAN 4 - 5 MINUTES WHEN RUNNING # | |
# THIS SCRIPT ON TWO COMPUTERS AT THE SAME TIME; WHEN RUNNING ON A SINGLE # | |
# COMPUTER YOU CAN CHANGE THE IP AS FAST AS 2 MINUTES AND 30 SECONDS. # | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment