Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # MD Harrington
- # Menu for using with X11Vnc and Remmina
- # Date today 08/10/2020
- STD='\033[0;0;39m' #reset
- IRed='\033[0;91m' # Red
- IGreen='\033[0;92m' # Green
- IYellow='\033[0;93m' # Yellow
- IBlue='\033[0;94m' # Blue
- IPurple='\033[0;95m' # Purple
- ICyan='\033[0;96m' # Cyan
- IWhite='\033[0;97m' # White
- #global variable
- CURRENTDATEONLY=`date +"%A, %b %d, %Y %H:%M:%S"`
- pause(){
- read -p "Press [Enter] to continue..." p_EnterKey
- }
- one(){
- echo "${IGreen}Starting X11Vnc Server${STD}"
- ## Start up file for x11vnc server change - allow for your ip
- ## for local subnet eg 192.168.100 end this last octed with a dot
- ## for multiple hosts then seperate ip wih , and change -nevershared to -shared
- ## and change rfbport to autoport
- ## ALL COMMANDS CAN BE FOUND ON THIS PAGE (X11VNC)
- ## https://linux.die.net/man/1/x11vnc
- x11vnc -nevershared -forever -rfbauth ~/.vnc/passwd -allow 192.168.1. -rfbport 5902
- pause
- }
- # do something in two()
- two(){
- echo "${IGreen}Stop X11Vnc Server${STD}"
- ## stop X11 server
- x11vnc -R stop
- pause
- }
- three(){
- echo "${IPurple}Quitting stopping VNC Server Thankyou ${STD}"
- x11vnc -R stop
- sleep 500
- exit 0
- }
- show_menus() {
- clear
- echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
- echo -e " M A I N - M E N U - V N C - S E R V E R "
- echo -e " MD HARRINGTON "
- echo -e "${IRed}* Date : ${CURRENTDATEONLY} *${STD}"
- echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
- echo -e "${ICyan}1. Start VNC Server ${STD}"
- echo -e "${ICyan}2. Stop VNC Server ${STD}"
- echo -e "${ICyan}3. Exit altogether and Menu Application ${STD}"
- }
- # read input from the keyboard and take a action
- # invoke the one() when the user select 1 from the menu option.
- # invoke the two() when the user select 2 from the menu option.
- # Exit when user the user select 3 form the menu option.
- read_options(){
- local choice
- read -p " Enter choice [ 1 - 4] " choice
- case $choice in
- 1) one ;;
- 2) two ;;
- 3) three ;;
- *) echo -e "${RED}Error...${STD}" && sleep 2
- esac
- }
- # ----------------------------------------------
- # Step #3: Trap CTRL+C, CTRL+Z and quit singles
- # ----------------------------------------------
- trap '' SIGINT SIGQUIT SIGTSTP
- while true
- do
- show_menus
- read_options
- done
Add Comment
Please, Sign In to add comment