feat: do not restart application if it is already started

This commit is contained in:
rodion 2024-01-11 01:50:16 +00:00
parent d98d8500ae
commit 094aa62a7b
1 changed files with 8 additions and 0 deletions

View File

@ -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