Autostart of nordvpn with AppVM (a.k.a App Qube)

Another “UPGRADE” is to add a time to change from one server to another after few time.

This version 02 is:

#!/bin/sh
nordvpn set analytics off
nordvpn set killswitch on
nordvpn set notify on
nordvpn set killswitch on
nordvpn login --token my.token.here
sleep 5s
countries=("Albania" "Germany" "Poland" "Argentina" "Greece" "Portugal" "Australia" "Hong_Kong" "Romania" "Austria" "Hungary" "Serbia" "Belgium" "Iceland" "Singapore" "Bosnia_And_Herzegovina" "Indonesia" "Slovakia" "Brazil" "Ireland" "Slovenia" "Bulgaria" "Israel" "South_Africa" "Canada" "Italy" "South_Korea" "Chile" "Japan" "Spain" "Colombia" "Latvia" "Sweden" "Costa_Rica" "Lithuania" "Switzerland" "Croatia" "Luxembourg" "Taiwan" "Cyprus" "Malaysia" "Thailand" "Czech_Republic" "Mexico" "Turkey" "Denmark" "Moldova" "Ukraine" "Estonia" "Netherlands" "United_Kingdom" "Finland" "New_Zealand" "United_States" "France" "North_Macedonia" "Vietnam" "Georgia" "Norway" "double_vpn")
nordvpn set autoconnect on

while true; do
  selected_country=${countries[RANDOM % ${#countries[@]}]}
  nordvpn c "$selected_country" &
  
  # Countdown
  for ((i=900; i>=0; i--)); do #a timer of 900 seconds (15 minutes) here
    minutes=$((i / 60))
    seconds=$((i % 60))
    printf "Next server change in: %02d:%02d\r" "$minutes" "$seconds" #just to show in terminal if you want to see
    sleep 1
  done
  echo ""
done

If you found any bug or improvement, please, let me know.