I forgot one cool thing about VNC. It is handy to copy and paste from the VNC window to the local desktop and back. This script kicks off vncconfig which allows copy and past between desktops. Remember, use the highlighted area for copy and the middle mouse button for paste.
#!/bin/bash ############################## # Run VNC Server on the local box with some parameters. ############################## # Yes or No routine YesNo() { echo -e "$1 (y/n)? \c" read answer case $answer in [yY]|[Yy][Ee][Ss]) answer=y;; [nN]|[Nn][Oo]) answer=n ;; esac } # If VNC Server is already running check if the user wants to kill it. if [ -n "`ps -elf | grep Xvnc | grep "${HOST}:1"`" ]; then YesNo "VNC Server is already running on display 1, Kill?" if [ $answer == 'y' ]; then vncserver -kill :1 sleep 5s if [ -n "`ps -elf | grep Xvnc | grep "${HOST}:1"`" ]; then echo "VNC Server :1 is still running. You may have to kill manually." exit 1 fi else echo "Exiting without running VNC Server." exit 0 fi fi # Kick off VNC Server vncserver :1 -geometry 1280x900 # run vncconfig, allows copy and paste from vnc sessions. export DISPLAY=${HOST}:1.0 vncconfig & |
No comments:
Post a Comment