É possível manter um servidor vnc ativo após efetuar logout?

1

Estou usando o OpenSUSE e criei um script que inicia na inicialização do servidor x11vnc. Mas quando o usuário efetua logout, x11vnc é eliminado. Eu quero começar de novo automaticamente. Aqui o script que eu escrevi. Funciona perfeitamente na inicialização.

#!/bin/sh
#
# /etc/init.d/vnc
#
### BEGIN INIT INFO
# Provides:          x11vnc server
# Required-Start:    xdm
# Should-Start: 
# Required-Stop: 
# Should-Stop: 
# Default-Start:     5
# Default-Stop:      0 1 2 6
# Short-Description: 
# Description:       Start or stop vnc server
### END INIT INFO


#INIT SCRIPT VARIABLES
SERVICE=$(basename $0)
#Gets the name of the script

BIN="/usr/bin/x11vnc"
#Binary path
ALLOWED_GROUP=$(getent group g_vnc-usr | awk -F ":" '{ print $4 }')
#Only inf-usr group is allowed to take control of any machine.

AUTH='ps wwaux | grep '/X.*-auth' | sed -e 's/^.*-auth *//' -e 's/ .*$//' | head -n 1'

OPT="-display :0 -auth ${AUTH} -nopw -unixpw ${ALLOWED_GROUP} -shared -oa /var/log/vnc.log -xkb -bg -verbose -forever"
#Various options of the x11vnc providing auth, user auth, logging and "keep alive" connection.

CMD="${BIN} ${OPT}"
#Both bin and options are stored

. /lib/lsb/init-functions

rc_reset
# Reset status of this service

case "$1" in
    start)
    echo -n "Starting ${SERVICE}..."
        ## Start daemon with startproc(8). 
    /sbin/startproc ${CMD}

    ##>> /dev/null 2>&1
    sleep 2s

    # Remember status and be verbose.
        rc_status -v
    ;;

    stop)
    echo -n "Shutting down ${SERVICE}..."
    ## Stop daemon with killproc(8) 
    /sbin/killproc ${BIN}

    # Remember status and be verbose
    rc_status -v
        ;;

    restart)
    ## Stop the service and regardless of whether it was
    ## running or not, start it again.
    $0 stop
    $0 start

    # Remember status and be quiet
    rc_status
    ;;

    status)
    echo -n "Checking for service ${SERVICE}..."
    ## Check status with checkproc(8), if process is running
    ## checkproc will return with exit status 0.
    /sbin/checkproc ${BIN}

    # Remember status and be verbose
    rc_status -v
    ;;
    *)
    echo -n 
    echo -n "Usage: ${SERVICE} {start|stop|restart|status}"
    exit 1
    ;;
esac
rc_exit

Esse script permite que qualquer usuário do grupo faça o computador funcionar mesmo se ninguém estiver logado.

Eu queria usar xinitrc e adicionar exec /etc/init.d/vnc restart

Obrigado.

    
por igor012 18.07.2012 / 18:15

1 resposta

1

(Convertendo um comentário para uma resposta)

O argumento -loop pode ser usado para reiniciar x11vnc em um loop. Na página do manual:

Create an outer loop restarting the x11vnc process whenever it terminates. -bg and -inetd are ignored in this mode (however see -loopbg below).

Useful for continuing even if the X server terminates and restarts (at that moment the process will need permission to reconnect to the new X server of course).

    
por 24.08.2012 / 16:23