Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # MD Harrington
- # Menu for using with X11Vnc Server and Remmina Place this on your server that wont to remote into
- # SSH into this eg <your logon name>@<IP addressof server>
- # Once in chmod +x the script then execute using ./scriptname.sh
- # open remmina on local host set up required fields in gui and bingo your screen local host refects remote host so
- # You can now work from anyway on the proviso they have issued correct permissions and set up port forwarding
- # 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
- x11vnc -auth guess -forever -rfbauth /home/mark/.vnc/passwd -rfbport 5900 -shared
- pause
- }
- # do something in two()
- two(){
- echo "${IGreen}Stop X11Vnc Server${STD}"
- ## stop X11 server
- x11vnc -R stop
- pause
- }
- 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 - 3] " choice
- case $choice in
- 1) one ;;
- 2) two ;;
- 3) exit 0 ;;
- *) 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