function nginx_start(){
process=`ps -ef | grep 'nginx' | grep -v 'grep'`
if [ ! -n "$process" ];
then
/usr/local/nginx/sbin/nginx
echo "Nginx service is running !"
exit 0
else
echo "Nginx service is existing !"
exit 1
fi
exit 0
}
function nginx_stop(){
process=`ps -ef | grep 'nginx' | grep -v 'grep'`
if [ ! -n "$process" ]; then
echo "Nginx service is already stopping !"
exit 1
else
ID=`ps -ef | grep 'nginx' | grep -v 'grep' | awk '{print $2}'`
for pid in $ID
do
kill -9 $pid
echo "Nginx service stopping ! process pid:$pid"
done
exit 0
fi
exit 0
}