piflow/piflow-bin/status.sh

20 lines
456 B
Bash
Raw Permalink 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
2020-03-13 17:44:59 +08:00
local pid
2019-07-29 16:08:15 +08:00
pid=$(ps ax | grep "$1" | grep -v grep | awk '{ print $1 }')
2019-08-22 17:39:33 +08:00
if [[ "" -ne $pid ]]
2019-07-29 16:08:15 +08:00
then
echo "server is Running!"
port=$(netstat -nltp | grep $pid | awk '{print $4}')
echo "$port"
else
echo "Server is Stopped!"
fi
}
2019-08-22 17:39:33 +08:00
#ps grep
#ps aux | grep "piflow.api.Main"| grep -v 'grep'
2020-03-13 17:44:59 +08:00
check_status piflow.api.Main