#!/bin/sh #保存应用进程pid #重试时间 second=5s while true do if [ -z "`findPortPid $1`" ] then echo "没有找到端口:$1的pid,$second后重试" sleep $second else echo "端口:$1的pid:`findPortPid $1`" echo `findPortPid $1`>run.pid break fi done