Автозагрузка x11vnc
Собственно, надо загружать x11vnc до того, как локально входит кто-нибудь из пользователей. В /etc/init.d лежит скрипт x11vnc (0755 root:root), вот он -
Код:
#! /bin/sh
VNC_BIN=/usr/bin/x11vnc
. /etc/rc.status
rc_reset
case "$1" in
start)
echo -n "Starting x11vnc "
$VNC_BIN -forever -auth /var/lib/xdm/authdir/authfiles/*
rc_status -v
;;
stop)
echo -n "Shutting down x11vnc "
/sbin/killproc -TERM $VNC_BIN
rc_status -v
;;
restart)
$0 stop
$0 start
rc_status
;;
status)
echo -n "Checking for service x11vnc "
/sbin/checkproc $VNC_BIN
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
rc_exit
Симлинк лежит в rc5.d -> @S16x11vnc. Автозагрузка не срабатывает, хотя по ssh можно вручную выполнить /etc/init.d/x11vnc start. Нужна именно автозагрузка!
ЗЫ. где бы логи посмотреть, почему не загружается...
|
Всем спасибо, уже нашел решение :). В /etc кладем этот скрипт (x11vnc_loop):
Код:
#!/bin/sh
#
# x11vnc_loop:
#
# Example startup script for connecting x11vnc to an X display
# at system boot up and having it reconnect when the X server restarts.
#
# Run, in rc.local say, via, e.g.:
#
# /path/to/x11vnc_loop 1>> /var/tmp/x11vnc_loop.log 2>&1 &
#
# call with argument "once" or a number to limit the number of loops.
#
##########################################################################
# The following needs to be customized:
x11vnc_cmd=x11vnc # or use full path (or set PATH). так и оставил
pwfile=/etc/vncpass # always use a password - у меня он лежит тут
display=:0 # display of interest - можно и другой, например :1
restart_sleep=5 # pause between X server restarts. - задержка на рестарт иксов, если комп медленный, ставим больше
# modify cmdline args if desired:
x11vnc_args="-display $display -rfbauth $pwfile -forever -nap"
# you may need to customize the "grep", etc, below in get_xauthority_file()
##########################################################################
if [ "X$1" != "X" ]; then
max=$1
shift
fi
get_xauthority_file() {
#
# We need to find the MIT-COOKIE file... this not portable at all,
# depends on OS, distro, desktop, phase of moon, etc...
#
# If the cookie file was fixed and you knew it, you could just
# return it here e.g.:
#
## echo "/var/gdm/:0.Xauth"; return
#
# or, if you knew the directory, you could look for the youngest
# file there and return it e.g.:
#
## echo `ls -t /var/lib/xdm/authdir/authfiles/* | head -1`; return
# this hack tries to grep it out of ps output...
xauth="/var/lib/xdm/authdir/authfiles/*"
# у меня этот файл лежит там, где он лежит в другом дистрибутиве смотрим так:
# ps wwwwaux | grep auth
sleep 2 # wait a bit in case X server is restarting slowly.
# done
echo $xauth
}
try=1
while [ 1 ]
do
echo "`date` $0 try number: $try"; try=`expr $try + 1`
auth=`get_xauthority_file`
if [ ! -r "$auth" ]; then
echo "`date` bad auth file: \"$auth\""
else
cmd="$x11vnc_cmd $x11vnc_args"
sleep 1
echo "`date` running: $cmd -auth $auth"
# run x11vnc:
$cmd -auth $auth
if [ "X$max" = "Xonce" ]; then
exit $?
fi
fi
if echo "$max" | grep '[0-9]' > /dev/null; then
if [ $try -gt $max ]; then
exit
fi
fi
sleep $restart_sleep
done
Делаем файл исполняемым и меняем пользователя/группу на root.
Далее, делаем фейк rc.local (описано тут ).
В конец добавляем строку - /etc/x11vnc_loop 1>> /var/tmp/x11vnc_loop.log 2>&1 &
Вроде, работет :)
|
Время: 04:50.
© OSzone.net 2001-