21 lines
886 B
Bash
Executable File
21 lines
886 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
echo "BEGIN $(date --rfc-3339=seconds)" 2>&1 | tee -a ./restartvpn.log
|
|
|
|
curl -s -X GET "http://127.0.0.1:8000/v1/publicip/ip" 2>&1 | tee -a ./restartvpn.log # Print the original IP
|
|
|
|
curl -s -X PUT -H "Content-Type: application/json" -d '{"status":"stopped"}' "http://127.0.0.1:8000/v1/openvpn/status" 2>&1 | tee -a ./restartvpn.log # Stop OpenVPN
|
|
|
|
sleep 5
|
|
|
|
curl -s -X PUT -H "Content-Type: application/json" -d '{"status":"running"}' "http://127.0.0.1:8000/v1/openvpn/status" 2>&1 | tee -a ./restartvpn.log # Start OpenVPN (changing the server it's connecting to)
|
|
|
|
sleep 5
|
|
|
|
curl -s -X GET "http://127.0.0.1:8000/v1/openvpn/status" 2>&1 | tee -a ./restartvpn.log # Print the Gluetun status
|
|
|
|
curl -s -X GET "http://127.0.0.1:8000/v1/publicip/ip" 2>&1 | tee -a ./restartvpn.log # Print the new IP
|
|
|
|
echo "END $(date --rfc-3339=seconds)" 2>&1 | tee -a ./restartvpn.log
|
|
|