Testing changes to TurboVNC on Fedora 43 and 44
/opt/TurboVNC/bin/vncviewer – change with symlink to
< BINDIR=$(dirname "$(readlink -f $0)")
> BINDIR=`dirname $0`
,
Move the /etc/rc.d tnvserver file to /opt/TurboVNC/bin/tvncserver
Remove all the tvncserver files with various name from /etc/rc.s
Use /etc/sysconfig/tvncservers to start TurboVNC session
Contents or /opt/TurboVNC/bin/tnvserver
#!/bin/bash
#
# chkconfig: - 91 35
# description: Starts and stops the TurboVNC Server
#
### If you are using LDAP or another distributed authentication system, then
### be sure to add any services needed for your distributed authentication
### system to the Required-Start line below.
#
### BEGIN INIT INFO
# Provides: tvncserver
# Required-Start: $syslog
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts and stops the TurboVNC Server
### END INIT INFO
# Source function library.
REDHAT=0
if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
REDHAT=1
else
if [ -f /lib/lsb/init-functions ]; then
. /lib/lsb/init-functions
else
echo "Unsupported platform"
exit 1
fi
fi
if [ $REDHAT -eq 1 ]; then
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
fi
unset VNCSERVERARGS
VNCSERVERS=""
if [ -f /etc/sysconfig/tvncservers ]; then
. /etc/sysconfig/tvncservers
fi
LOCKDIR=/var/lock
if [ -d /var/lock/subsys ]; then
LOCKDIR=/var/lock/subsys
fi
prog=$"TurboVNC server"
start() {
echo -n $"Starting $prog: "
ulimit -S -c 0 >/dev/null 2>&1
RETVAL=NONE
for display in ${VNCSERVERS}
do
unset BASH_ENV ENV
DISP="${display%%:*}"
export VNCUSERARGS="${VNCSERVERARGS[${DISP}]}"
_OUT=`echo ${display}; su ${display##*:} -c "cd ~${display##*:} && /opt/TurboVNC/bin/vncserver :${display%%:*} -quiet ${VNCUSERARGS}" 2>&1`
_RETVAL=$?
if [[ ! $_OUT =~ "A VNC server is already running" ]]; then
RETVAL=$_RETVAL
echo -n "${display} "
logger -p local7.notice "$_OUT"
fi
done
if [ "$RETVAL" != "NONE" ]; then
if [ $REDHAT -eq 1 ]; then
[ "$RETVAL" -eq 0 ] && success $"vncserver startup" || \
failure $"vncserver start"
else
[ "$RETVAL" -eq 0 ] && log_success_msg "[ OK ]" || \
log_failure_msg "[FAILED]"
fi
[ "$RETVAL" -eq 0 ] && touch $LOCKDIR/tvncserver
fi
echo
}
shutdown() {
echo -n $"Shutting down $prog: "
RETVAL=NONE
for display in ${VNCSERVERS}
do
echo -n "${display} "
unset BASH_ENV ENV
_OUT=`echo ${display}; su ${display##*:} -c "/opt/TurboVNC/bin/vncserver -kill :${display%%:*}" 2>&1`
RETVAL=$?
if [[ ! $_OUT =~ "You'll have to kill the Xvnc process manually" ]]; then
logger -p local7.notice "$_OUT"
fi
done
if [ "$RETVAL" != "NONE" ]; then
if [ $REDHAT -eq 1 ]; then
[ "$RETVAL" -eq 0 ] && success $"vncserver shutdown" || \
failure $"vncserver shutdown"
else
[ "$RETVAL" -eq 0 ] && log_success_msg "[ OK ]" || \
log_failure_msg "[FAILED]"
fi
fi
echo
}
stop() {
shutdown
if [ "$RETVAL" != "NONE" ]; then
[ "$RETVAL" -eq 0 ] && rm -f $LOCKDIR/tvncserver
fi
}
reload() {
# Walk the process list and shut down any TurboVNC sessions that aren't
# specified in the tvncservers file.
for active in `ps uh -C Xvnc | grep /opt/TurboVNC/bin/Xvnc | awk '{ print $12, $16 }' | tr -d ':' | tr ' ' ':' | sed -e 's/(//' -e 's/)//'`
do
skip=
for display in ${VNCSERVERS}
do
if [[ $active == $display ]]; then
skip=1
break;
fi
done
if [[ ! -n $skip ]]; then
killlist+=("$active")
fi
done
VNCSERVERS_BAK=${VNCSERVERS}
VNCSERVERS=${killlist}
shutdown
VNCSERVERS=${VNCSERVERS_BAK}
# Start any TurboVNC sessions specified in the tvncservers file that
# haven't been started yet.
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
reload)
reload
;;
condrestart)
if [ -f $LOCKDIR/tvncserver ]; then
stop
start
fi
;;
status)
status Xvnc
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
exit 1
esac
=========================
Files added for systemd setup to /etc/systemd/system
403 Jun 29 08:34 tvncserver.service
38 Jun 28 13:29 tvncserver.service -> /etc/systemd/system/tvncserver.service
38 Jun 28 13:29 tvncserver.service -> /etc/systemd/system/tvncserver.service
Earlier had used the original location, but moved file to /opt/TurboVNC/bin since rc.d location might be removed.
> ExecStart=/etc/rc.d/init.d/tvncserver start
> ExecStop=/etc/rc.d/init.d/tvncserver stop
> ExecReload=/etc/rc.d/init.d/tvncserver reload
< ExecStart=/opt/TurboVNC/bin/tvncserver start
< ExecStop=/opt/TurboVNC/bin/tvncserver stop
< ExecReload=/opt/TurboVNC/bin/tvncserver reload
Contents
cat tvncserver.service
[Unit]
Description=TurboVNC Server
After=network.target syslog.target
[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
SuccessExitStatus=5 6
ExecStart=/opt/TurboVNC/bin/tvncserver start
ExecStop=/opt/TurboVNC/bin/tvncserver stop
ExecReload=/opt/TurboVNC/bin/tvncserver reload
[Install]
WantedBy=multi-user.target graphical.target
Don’t know if I am missing anything? Seems to work on my 7 machines running Fedora 43 and 44