From 094aa62a7b958f555ad12d796d207f10af15a1e2 Mon Sep 17 00:00:00 2001 From: rodion Date: Thu, 11 Jan 2024 01:50:16 +0000 Subject: [PATCH] feat: do not restart application if it is already started --- start.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/start.sh b/start.sh index da7199fb..963c7e94 100755 --- a/start.sh +++ b/start.sh @@ -1,5 +1,6 @@ #!/bin/bash # Sample usage: RUN_IN_BACKGROUND=1 ./start.sh +# set FORCE_KILL=1 to force restart vnc server and client if it is already running # set FORCE_REINSTALL_TURBOVNC=1 to reinstall turbovnc to the latest version # set RUN_IN_BACKGROUND=1 to start proxy and vnc client in background @@ -13,6 +14,13 @@ cd "$SCRIPT_DIR" hasUpdated=0 NOVNC_PORT=6080 +if [ -z $FORCE_KILL ]; then + if pgrep -f novnc_proxy >/dev/null && pgrep -f vncserver >/dev/null && pgrep -f xfce4 >/dev/null; then + printf "Virtual desktop already running on $NOVNC_PORT-$WEB_HOST/vnc.html\n" + exit + fi +fi + # desktop environment installation if ! dpkg-query -W -f='${Status}' xfce4 2>/dev/null | grep -q "install ok installed"; then sudo apt update