tigervnc/vncserver.init
Adam Tkac 7535a9df26 - update to r3751
- patches merged
- tigervnc-xclients.patch
- tigervnc-clipboard.patch
- tigervnc-rh212985.patch
- basic RandR support in Xvnc (resize of the desktop)
- use built-in libjpeg (SSE2/MMX accelerated encoding on x86 platform)
- use Tight encoding by default
- use TigerVNC icons
2009-04-03 17:07:49 +00:00

126 lines
2.6 KiB
Bash

#!/bin/bash
#
# chkconfig: - 91 35
# description: Starts and stops vncserver. \
# used to provide remote X administration services.
### BEGIN INIT INFO
# Provides: vncserver
# Required-Start: $network $named
# Required-Stop: $network $named
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: start|stop|restart|try-restart|status|force-reload vncserver
# Description: control vncserver which exports your desktop
### END INIT INFO
# Source function library.
. /etc/init.d/functions
[ -r /etc/sysconfig/vncservers ] && . /etc/sysconfig/vncservers
prog=$"VNC server"
RETVAL=0
start() {
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 1
[ -x /usr/bin/vncserver ] || exit 5
[ -x /usr/bin/Xvnc ] || exit 5
echo -n $"Starting $prog: "
RETVAL=0
if [ ! -d /tmp/.X11-unix ]
then
mkdir -m 1777 /tmp/.X11-unix || :
restorecon /tmp/.X11-unix 2>/dev/null || :
fi
for display in ${VNCSERVERS}
do
SERVS=1
echo -n "${display} "
DISP="${display%%:*}"
USER="${display##*:}"
VNCUSERARGS="${VNCSERVERARGS[${DISP}]}"
runuser -l ${USER} -c "cd ~${USER} && [ -r .vnc/passwd ] && vncserver :${DISP} ${VNCUSERARGS}"
RETVAL=$?
[ "$RETVAL" -eq 0 ] || break
done
if [ -z "$SERVS" ]; then
echo -n "no displays configured "
failure
RETVAL=6
else
if [ "$RETVAL" -eq 0 ]; then
success $"vncserver startup"
touch /var/lock/subsys/vncserver
else
failure $"vncserver start"
fi
fi
echo
return "$RETVAL"
}
stop() {
echo -n $"Shutting down $prog: "
for display in ${VNCSERVERS}
do
echo -n "${display} "
export USER="${display##*:}"
runuser ${USER} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1
done
RETVAL=$?
[ "$RETVAL" -eq 0 ] && success $"vncserver shutdown" || \
failure $"vncserver shutdown"
echo
[ "$RETVAL" -eq 0 ] && rm -f /var/lock/subsys/vncserver
return "$RETVAL"
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload)
stop
sleep 3
start
;;
condrestart)
echo "condrestart is obsolete, use try-restart instead"
if [ -e /var/lock/subsys/vncserver ]; then
stop
sleep 3
start
fi
;;
try-restart)
if [ -e /var/lock/subsys/vncserver ]; then
stop
sleep 3
start
fi
;;
status)
status Xvnc
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|try-restart|status|force-reload}"
exit 3
esac
exit "$RETVAL"