1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-06-30 22:50:14 +02:00

fixed gunicorn start and added stop

This commit is contained in:
Galonza Peter 2021-10-18 02:40:08 +03:00
parent f0f9ac92e6
commit 898694b9be
2 changed files with 10 additions and 4 deletions

View File

@ -1183,6 +1183,8 @@ def run_dashboard():
Get host and port for web-server
"""
def get_host_bind():
config = configparser.ConfigParser(strict=False)
config.read('wg-dashboard.ini')
app_ip = config.get("Server", "app_ip")
app_port = config.get("Server", "app_port")

View File

@ -2,7 +2,7 @@
app_name="dashboard.py"
app_official_name="WGDashboard"
environment=$(if [[ $ENVIRONMENT ]] ; then echo $ENVIRONMENT else echo 'develop')
environment=$(if [[ $ENVIRONMENT ]]; then echo $ENVIRONMENT; else echo 'develop'; fi)
dashes='------------------------------------------------------------'
equals='============================================================'
help () {
@ -51,7 +51,7 @@ check_wgd_status(){
}
start_wgd () {
if [[ $environment == 'production']]; then
if [[ $environment == 'production' ]]; then
printf "%s\n" "$dashes"
printf "| Starting WGDashboard in the background. |\n"
if [ ! -d "log" ]
@ -59,7 +59,7 @@ start_wgd () {
fi
d=$(date '+%Y%m%d%H%M%S')
/usr/local/bin/gunicorn --access-logfile log/access_"$d".log \
--error-logfile log/error_"$d".log 'dashboard.run_dashboard()'
--error-logfile log/error_"$d".log 'dashboard:run_dashboard()'
printf "| Log files is under log/ |\n"
printf "%s\n" "$dashes"
else
@ -76,7 +76,11 @@ start_wgd () {
}
stop_wgd() {
kill "$(ps aux | grep "[p]ython3 $app_name" | awk '{print $2}')"
if [[ $environment == 'production' ]]; then
kill $(cat ./gunicorn.pid)
else
kill "$(ps aux | grep "[p]ython3 $app_name" | awk '{print $2}')"
fi
}
start_wgd_debug() {