From 0c37d93c0156826efa6fa2b7f24ed3f0da6fe147 Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Sun, 4 Aug 2024 15:29:07 -0400 Subject: [PATCH] Testing if this will fix bash exit before Gunicorn ran... --- src/gunicorn.conf.py | 2 +- src/wg-dashboard.service | 2 +- src/wgd.sh | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gunicorn.conf.py b/src/gunicorn.conf.py index 0692532..9a2a458 100644 --- a/src/gunicorn.conf.py +++ b/src/gunicorn.conf.py @@ -9,4 +9,4 @@ workers = 1 threads = 1 bind = f"{app_host}:{app_port}" daemon = True -pidfile = './gunicorn.pid' \ No newline at end of file +pidfile = './gunicorn.pid' diff --git a/src/wg-dashboard.service b/src/wg-dashboard.service index d6ca41f..1722b3a 100644 --- a/src/wg-dashboard.service +++ b/src/wg-dashboard.service @@ -11,4 +11,4 @@ Restart=always [Install] -WantedBy=multi-user.target +WantedBy=multi-user.target \ No newline at end of file diff --git a/src/wgd.sh b/src/wgd.sh index c0b5344..e948cde 100755 --- a/src/wgd.sh +++ b/src/wgd.sh @@ -240,6 +240,16 @@ gunicorn_start () { sudo "$venv_gunicorn" --access-logfile log/access_"$d".log \ --log-level 'debug' --capture-output \ --error-logfile log/error_"$d".log 'dashboard:app' + + checkPIDExist=0 + while [ $checkPIDExist -eq 0 ] + do + if [ ! -f './gunicorn.pid' ]; then + checkPIDExist=1 + fi + sleep 2 + done + printf "[WGDashboard] Log files is under ./log\n" printf "%s\n" "$dashes" }