mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-04-19 08:55:12 +00:00
refactored
This commit is contained in:
parent
c0fbf4dd0c
commit
94a0d5a0a4
36
src/wgd.sh
36
src/wgd.sh
@ -57,21 +57,29 @@ check_wgd_status(){
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gunicorn_start () {
|
||||||
|
printf "%s\n" "$dashes"
|
||||||
|
printf "| Starting WGDashboard in the background. |\n"
|
||||||
|
if [ ! -d "log" ]
|
||||||
|
then mkdir "log"
|
||||||
|
fi
|
||||||
|
d=$(date '+%Y%m%d%H%M%S')
|
||||||
|
if [[ $USER == root ]]; then
|
||||||
|
export PATH=$PATH:/usr/local/bin:$HOME/.local/bin
|
||||||
|
fi
|
||||||
|
gunicorn --access-logfile log/access_"$d".log \
|
||||||
|
--error-logfile log/error_"$d".log 'dashboard:run_dashboard()'
|
||||||
|
printf "| Log files is under log/ |\n"
|
||||||
|
printf "%s\n" "$dashes"
|
||||||
|
}
|
||||||
|
|
||||||
|
gunicorn_stop () {
|
||||||
|
kill $(cat ./gunicorn.pid)
|
||||||
|
}
|
||||||
|
|
||||||
start_wgd () {
|
start_wgd () {
|
||||||
if [[ $environment == 'production' ]]; then
|
if [[ $environment == 'production' ]]; then
|
||||||
printf "%s\n" "$dashes"
|
gunicorn_start
|
||||||
printf "| Starting WGDashboard in the background. |\n"
|
|
||||||
if [ ! -d "log" ]
|
|
||||||
then mkdir "log"
|
|
||||||
fi
|
|
||||||
d=$(date '+%Y%m%d%H%M%S')
|
|
||||||
if [[ $USER == root ]]; then
|
|
||||||
export PATH=$PATH:/usr/local/bin:$HOME/.local/bin
|
|
||||||
fi
|
|
||||||
gunicorn --access-logfile log/access_"$d".log \
|
|
||||||
--error-logfile log/error_"$d".log 'dashboard:run_dashboard()'
|
|
||||||
printf "| Log files is under log/ |\n"
|
|
||||||
printf "%s\n" "$dashes"
|
|
||||||
else
|
else
|
||||||
printf "%s\n" "$dashes"
|
printf "%s\n" "$dashes"
|
||||||
printf "| Starting WGDashboard in the background. |\n"
|
printf "| Starting WGDashboard in the background. |\n"
|
||||||
@ -87,7 +95,7 @@ start_wgd () {
|
|||||||
|
|
||||||
stop_wgd() {
|
stop_wgd() {
|
||||||
if [[ $environment == 'production' ]]; then
|
if [[ $environment == 'production' ]]; then
|
||||||
kill $(cat ./gunicorn.pid)
|
gunicorn_stop
|
||||||
else
|
else
|
||||||
kill "$(ps aux | grep "[p]ython3 $app_name" | awk '{print $2}')"
|
kill "$(ps aux | grep "[p]ython3 $app_name" | awk '{print $2}')"
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user