Skip to content

Commit

Permalink
Added service prefixes to logs
Browse files Browse the repository at this point in the history
  • Loading branch information
dmotte committed May 22, 2024
1 parent 6715aaf commit 9c1ada4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions build/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

################################## VARIABLES ###################################
########################### VARIABLES AND FUNCTIONS ############################

# Ensure that the HOME environment variable is defined
: "${HOME:?}"
Expand All @@ -14,6 +14,8 @@ unset VNC_PASS
vnc_port=${VNC_PORT:-5901}
novnc_port=${NOVNC_PORT:-6901}

withprefix() { while read -r i; do echo "$1$i"; done }

################### INCLUDE SCRIPTS FROM /opt/startup-early ####################

for i in /opt/startup-early/*.sh; do
Expand Down Expand Up @@ -59,20 +61,22 @@ done
trap 'kill $(jobs -p)' EXIT

echo 'Starting Xvfb'
/usr/bin/Xvfb :0 -screen 0 "${resolution}x24" -nolisten tcp -nolisten unix &
/usr/bin/Xvfb :0 -screen 0 "${resolution}x24" -nolisten tcp \
-nolisten unix 2>&1 | withprefix 'Xvfb: ' &
sleep 2

echo 'Starting LXDE'
DISPLAY=:0 /usr/bin/startlxde &
DISPLAY=:0 /usr/bin/startlxde 2>&1 | withprefix 'LXDE: ' &
sleep 2

echo 'Starting x11vnc'
/usr/bin/x11vnc -display :0 -xkb -forever -shared -repeat -capslock \
-rfbport "$vnc_port" "$vncpwoption" &
-rfbport "$vnc_port" "$vncpwoption" 2>&1 | withprefix 'x11vnc: ' &
sleep 2

echo 'Starting noVNC'
/usr/bin/websockify --web=/usr/share/novnc "$novnc_port" "127.0.0.1:$vnc_port" &
/usr/bin/websockify --web=/usr/share/novnc "$novnc_port" \
"127.0.0.1:$vnc_port" 2>&1 | withprefix 'noVNC: ' &

wait # until all jobs finish
trap - EXIT

0 comments on commit 9c1ada4

Please sign in to comment.