Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# Exec TigerVNC server
# Set port
if [ "x$BASE_PORT" == "x" ]; then
DESKTOP_NUMBER=0
else
DESKTOP_NUMBER=$(($BASE_PORT-5900+1))
fi
# Set password
if [ "x$AUTH_PASS" != "x" ]; then
echo "[INFO] Setting up VNC password..."
mkdir -p /home/metauser/.vnc
/opt/tigervnc/usr/bin/vncpasswd -f <<< $AUTH_PASS > /home/metauser/.vnc/passwd
chmod 600 /home/metauser/.vnc/passwd
export VNC_AUTH=True
else
echo "[INFO] Not setting up any VNC password"
fi
# Run VNC server
if [ "x$VNC_AUTH" == "xTrue" ]; then
/opt/tigervnc/usr/bin/vncserver :$DESKTOP_NUMBER -SecurityTypes vncauth,tlsvnc -xstartup /opt/tigervnc/xstartup
else
/opt/tigervnc/usr/bin/vncserver :$DESKTOP_NUMBER -SecurityTypes None -xstartup /opt/tigervnc/xstartup
fi
# Check if VNC is running. If it is not, exit
while true
do
PSOUT=$(ps -ef | grep /opt/tigervnc/usr/bin/Xvnc | grep SecurityTypes)
if [[ "x$PSOUT" == "x" ]] ; then
exit 1
fi
# Sleep other 10 secs before re-checking
sleep 10
done