
Upon selecting your default CLI text editor, your current cron jobs/tabs are listed. If you are an old timer (no offense) you are probably very familiar and prefer vim or vi (YIKES!!) I chose nano as I am more comfortable with it and it it the easiest. In my case I was asked for 1) nano 2) vi 3) vim. Note: If this is your first time running or adding a cron job, it will ask for your favorite bash command line editor. Open the terminal (bash shell) and type the following: So, let's add an automated cron job to do just that. Then add a cron job (or tab) to run this script automated every 3 hrs. If you are asked your root credentials, please do so. Important: you need to make "/etc/nordvpn_boot.sh" readable and executable by running this command in the terminal: # Final connection attempt activated when everything goes well. Blame NordVPN for this one, not the script. # Disconnect check to ensure it doesn't claim to be connected while it actually isn't. Timeout 5s bash -c 'nordvpn d | grep -q "You are not connected to NordVPN."'Įcho "$(date) "Įcho "$(date) [Second reconnect failed, restarting NordVPN (30s)"

Timeout 5s bash -c 'nordvpn d | grep -q "You are disconnected from NordVPN."'

Timeout 5s bash -c 'nordvpn status | grep -q "Status: Connected"' Systemctl restart rvice | systemctl restart rvice I saved it as "nordvpn_boot.sh" to /etc so the filepath is "/etc/nordvpn_boot.sh": So, instead of giving up, I rolled my sleeves and went to battle.įirst, I found this nice bash script in this subreddit community. Timeout 5s nordvpn whitelist add ports 6881 6889 #BitTorrent Timeout 5s nordvpn whitelist add port 2302 #Halo Timeout 5s nordvpn whitelist add port 143 #IMAP4 Timeout 5s nordvpn whitelist add ports 443 445 #HTTP over SSL, MSFT DS Timeout 5s nordvpn whitelist add ports 137 139 #NetBIOS Timeout 5s nordvpn whitelist add subnet 192.168.0.0/24 #my local subnet # timeout 5s nordvpn s obfuscate off #ovpn only # timeout 5s nordvpn s protocol udp #ovpn only

Timeout 5s nordvpn s technology NordLynx (or openvpn) Please note, I have tried every NordVPN setting in many diferent configurations in my script (below):

I have tried every which way to stabilize the connection to at lest overnight but I found out when I ran a PING script that echoes the timestamp that the connection lasts roughly 3-4 hours at a time. I recently upgraded my Ubuntu headless server to 21.04 from 20.04 (don't ask me - I am adventorous) :Dīut I found out thereafter (of course) that NordVPN CLI client, which have worked flawlessly with 20.40, now is crappy and unstable in 21.04.
