1. 先把服务启动起来,通过ps -ef|grep 关键词找到对应的pid,比如
ps -ef|grep tomcat
2. 通过pid查询对应的端口信息
netstat -antup |grep LISTEN | grep 17565 | awk -F ':' '{if($4<20000) {print $4}}'
1. 先把服务启动起来,通过ps -ef|grep 关键词找到对应的pid,比如
ps -ef|grep tomcat
2. 通过pid查询对应的端口信息
netstat -antup |grep LISTEN | grep 17565 | awk -F ':' '{if($4<20000) {print $4}}'