#!/bin/bash pid=$(ps -ef | grep 'go run /xxx/main.go' | grep -v grep | awk '{print $2}') if [ -n "$pid" ]; then kill $pid fi pid2=$(netstat -tulnp | grep 8012 | grep -v grep | awk '{print $7}' | awk -F "/" '{print $1}') if [ -n "$pid2" ]; then kill $pid2 fi PORT=8012 nohup go run /xxx/main.go > /xxx/run.log &
0 评论
最新