1. 程式人生 > >【13】程序監控指令碼-getPID.sh

【13】程序監控指令碼-getPID.sh

#!/bin/bash

# get size of java process PID

PName=$1
#echo $PName

      if [ "$PName" != "" ];then   
       pid=`ps aux | grep $PName | grep -v grep | grep -v zabbix |awk '{print $2}'` 
       echo $pid
   fi