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 }')
|
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'
|
2019-07-29 16:08:15 +08:00
|
|
|
check_status piflow.api.Main
|