forked from capricornxl/ad-password-self-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuwsgiserver
executable file
·53 lines (46 loc) · 1.25 KB
/
uwsgiserver
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# Startup script for the uwsgi server
# chkconfig: - 85 15
# description: uwsgi server is Web Server
# HTML files and CGI.
# processname: uwsgiserver
INI="PWD_SELF_SERVICE_HOME/uwsgi.ini"
UWSGI="PYTHON_VENV_DIR/bin/uwsgi"
PSID="ps aux | grep "uwsgi"| grep -v "grep" | wc -l"
if [ ! -n "$1" ]
then
content="Usages: sh uwsgiserver [start|stop|restart|status]"
echo -e "\033[31m $content \033[0m"
exit 0
fi
if [ $1 = start ]
then
if [ `eval $PSID` -gt 4 ]
then
content="uwsgi is running!"
echo -e "\033[32m $content \033[0m"
exit 0
else
$UWSGI $INI
content="Start uwsgi service [OK]"
echo -e "\033[32m $content \033[0m"
fi
elif [ $1 = stop ];then
if [ `eval $PSID` -gt 4 ];then
killall -9 uwsgi
fi
content="Stop uwsgi service [OK]"
echo -e "\033[32m $content \033[0m"
elif [ $1 = restart ];then
if [ `eval $PSID` -gt 4 ];then
killall -9 uwsgi
fi
$UWSGI --ini $INI
content="Restart uwsgi service [OK]"
echo -e "\033[32m $content \033[0m"
elif [ $1 = status ];then
ps -ef | grep uwsgi | grep -v "uwsgiserver" | grep -v "grep"
else
content="Usages: sh uwsgiserver [start|stop|restart|status]"
echo -e "\033[31m $content \033[0m"
fi