#! /bin/bash
time=$(date "+%Y-%m-%d %H:%M:%S")
PORT=1000
ProcNumber=`lsof -i:$PORT|wc -l`
if [ $ProcNumber -le 0 ];then
echo "Port $PORT is not run $time"
node app.js >> /root/work.log
else
echo "Port $PORT is running $time"
fi
未经允许不得转载:互联网骚操作 » 监测进程,端口是否存在,重启某服务,这是农民世界API接口脚本
评论前必须登录!