51 lines
1.3 KiB
Bash
51 lines
1.3 KiB
Bash
#!/bin/bash
|
|
# Startup script for the uwsgi server
|
|
# chkconfig: - 85 15
|
|
# description: uwsgi server is Web Server
|
|
# HTML files and CGI.
|
|
# processname: uwsgiserver
|
|
|
|
INI="/opt/password-self-service/uwsgi.ini"
|
|
UWSGI="/usr/local/bin/uwsgi"
|
|
PSID=$(ps -ef | grep "password-self-service-uwsgi uWSGI master" | grep -v grep | awk '{print $2}')
|
|
|
|
if [ ! -n "$1" ]
|
|
then
|
|
content="Usages: $0 [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 $INI
|
|
content="Start uWsgi Service [OK]"
|
|
echo -e "\033[32m $content \033[0m"
|
|
fi
|
|
|
|
elif [ $1 = stop ];then
|
|
kill -9 $PSID > /dev/null 2>&1
|
|
content="Stop uWsgi Service [OK]"
|
|
echo -e "\033[32m $content \033[0m"
|
|
|
|
elif [ $1 = restart ];then
|
|
kill -9 $PSID > /dev/null 2>&1
|
|
echo "Pls wait...."
|
|
sleep 3s
|
|
$UWSGI --ini $INI
|
|
content="Restart uWsgi Service [OK]"
|
|
echo -e "\033[32m $content \033[0m"
|
|
|
|
elif [ $1 = status ];then
|
|
ps -ef | grep "password-self-service-uwsgi" | grep -v "grep"
|
|
else
|
|
content="Usages: $0 [start|stop|restart|status]"
|
|
echo -e "\033[31m $content \033[0m"
|
|
fi
|