dawnrazor 0 Posted ... Since the Network manager failed on me I came across a nice menu script which I adapted to run my openvpn commands and included a disconnect too so it is easier to change to other servers. I've tested this script and it works perfectly, just save it into the same directory as your .ovpn files. #!/bin/bashshow_menu(){ NORMAL=`echo "\033[m"` MENU=`echo "\033[36m"` #Blue NUMBER=`echo "\033[33m"` #yellow FGRED=`echo "\033[41m"` RED_TEXT=`echo "\033[31m"` ENTER_LINE=`echo "\033[33m"` echo -e "${MENU}*********************************************${NORMAL}" echo -e "${MENU}${NORMAL}" echo -e "${MENU}${NORMAL}" echo -e "${MENU}******${NUMBER} 1)${MENU} VPN-name ${NORMAL}" #change VPN-name to your server name echo -e "" echo -e "${MENU}******${NUMBER} 2)${MENU} VPN-name ${NORMAL}" #change VPN-name to your server name echo -e "" echo -e "${MENU}******${NUMBER} 3)${MENU} VPN-name ${NORMAL}" #change VPN-name to your server name echo -e "" echo -e "${MENU}******${NUMBER} 4)${MENU} VPN-name ${NORMAL}" #change VPN-name to your server name echo -e "" echo -e "${MENU}******${NUMBER} 5)${MENU} Disconnect VPN ${NORMAL}" #kill openvpn restoring connection to normal echo -e "${MENU}${NORMAL}" echo -e "${MENU}*********************************************${NORMAL}" echo -e "${ENTER_LINE}Please enter a menu option and enter or ${RED_TEXT}enter to exit. ${NORMAL}" read opt}function option_picked() { COLOR='\033[01;31m' # bold red RESET='\033[00;00m' # normal white MESSAGE=${@:-"${RESET}Error: No message passed"} echo -e "${COLOR}${MESSAGE}${RESET}"} clearshow_menuwhile [ opt != '' ] do if [[ $opt = "" ]]; then exit; else case $opt in 1) clear; option_picked "Option 1 Picked"; sudo openvpn --config /path/to/file/yourfile.ovpn; #change to the path for your downloaded config file menu; ;; 2) clear; option_picked "Option 2 Picked"; sudo openvpn --config /path/to/file/yourfile.ovpn; #change to the path for your downloaded config file menu; ;; 3) clear; option_picked "Option 3 Picked"; sudo openvpn --config /path/to/file/yourfile.ovpn; #change to the path for your downloaded config file show_menu; ;; 4) clear; option_picked "Option 4 Picked"; ssudo openvpn --config /path/to/file/yourfile.ovpn; #change to the path for your downloaded config file show_menu; ;; 5) clear; option_picked "Option 5 picked"; sudo killall -SIGINT openvpn show_menu; ;; x)exit; ;; \n)exit; ;; *)clear; option_picked "Pick an option from the menu"; show_menu; ;; esacfidone ------------------------------Remember to change the locations and names of your ovpn files in the script. the script can be run with a single click in KDE by adding this desktop launcher.. #!/usr/bin/env xdg-open[Desktop Entry]Comment[en_GB]=menu scriptComment=menu script# put name of your script hereExec=./nameofscript GenericName[en_GB]=GenericName=Icon[en_GB]=browserIcon=browserMimeType=Name[en_GB]=AirVPN.scriptName=AirVPN.script# put path to your script herePath=/path/to/your/scriptStartupNotify=trueTerminal=trueTerminalOptions=Type=ApplicationVersion=1.0X-DBUS-ServiceName=X-DBUS-StartupType=X-KDE-SubstituteUID=falseX-KDE-Username= save it on the desktop with an extension .desktop eg. AirVPN.desktop. and you are good to go ! Quote Share this post Link to post
shiroironin 0 Posted ... Thanks, modified this run from within a FreeBSD-jail - works My scripting skills are very limited, but I wonder if theres a way to improve this, for example 1 check if torrent-tracker NNN is available (ping, telnet..?)2 if not, pick up option 23 wait 5 mins 4 recheck, if tracker not availeble, pick up option 3 ... etc Quote Share this post Link to post