Skip to main content

ProtonVPNIPCycler.sh

This is a little script you can run that will automatically disconnect and reconnect from ProtonVPN and log everything (including IP) to a log file.

#!/bin/bash

LOGFILE="protonspray.log"

while true; do
{
TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S")

echo "[$TIMESTAMP] Disconnecting from ProtonVPN"
protonvpn-cli d

echo "[$TIMESTAMP] Sleeping for 7 seconds"
sleep 7

echo "[$TIMESTAMP] Reconnecting to VPN"
protonvpn-cli c -r

echo "Sleeping a few seconds"
sleep 3

echo "[$TIMESTAMP] Checking my IP address!"
IP=$(curl -s https://ifconfig.me)
echo "[$TIMESTAMP] Current IP: $IP"

} >> "$LOGFILE" 2>&1

sleep 180
done