piflow/piflow-bin/status.sh

19 lines
398 B
Bash
Raw Normal View History

2019-07-29 16:08:15 +08:00
#!/bin/bash
#ps term
function check_status()
{
[ ${#} -eq 0 ] && echo "usage: $FUNCNAME STRING" && return 0
local pid
pid=$(ps ax | grep "$1" | grep -v grep | awk '{ print $1 }')
if [ $pid != "" ]
then
echo "server is Running!"
port=$(netstat -nltp | grep $pid | awk '{print $4}')
echo "$port"
else
echo "Server is Stopped!"
fi
}
check_status piflow.api.Main