Skip to content

Instantly share code, notes, and snippets.

@unixnut
Created September 12, 2012 11:37
Show Gist options
  • Save unixnut/3706096 to your computer and use it in GitHub Desktop.
Save unixnut/3706096 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Use with GDM (SuSE, Ubuntu, RHEL, CentOS)
# place into /etc/gdm/Init/
if [ -x /usr/local/sbin/console_vnc ] ; then
/usr/local/sbin/console_vnc
else
echo warning: /usr/local/sbin/console_vnc not found
fi
#!/bin/sh
# Use with GDM (SuSE, Ubuntu, RHEL, CentOS)
# place into /etc/gdm/Init/
if [ -x /usr/local/sbin/console_vnc ] ; then
/usr/local/sbin/console_vnc
else
echo warning: /usr/local/sbin/console_vnc not found
fi
#! /bin/sh
if [ -x /usr/bin/x0vncserver ] ; then
prog=x0vncserver
else
prog=x11vnc
fi
metalogfile=/var/log/console_vnc.log
# start x11vnc/x0vncserver if it isn't already running
if [ -z "$(pgrep -x $prog)" ] ; then
date >> $metalogfile
echo XAUTHORITY=$XAUTHORITY >> $metalogfile
if [ $prog = x11vnc ] ; then
x11vnc -display :0 -forever -bg -xkb -o /var/log/$prog.log -passwdfile /root/.vnc/passwd
# -allow 192.168.1.
else
# see http://www.tigervnc.org/
x0vncserver -PasswordFile=/root/.vnc/passwd -display=:0 -Log=/var/log/$prog.log -DisconnectClients=off
fi
# store the PID just for reference
echo -n 'PID: ' >> $metalogfile
pgrep -x $prog >> $metalogfile
else
echo $(date) -- already running >> $metalogfile
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment