相關shell如下:
#!/bin/bash
#10018_restart
#wyk-20150518
/opt/uniisp/.bash_profile
PID=`ps -ef | grep 10018_sp_client | grep -v grep | awk '{print $2}' `
echo $PID
#/usr/sbin/lsof -p $PID >> /opt/uniisp/shell/log/test.txt
/usr/sbin/lsof -p $PID | grep "can't" >/opt/uniisp/shell/log/10018.$$ 2>&1
/usr/sbin/lsof -p $PID | grep "identify protocol" >>/opt/uniisp/shell/log/10018.$$ 2>&1
/usr/sbin/lsof -p $PID | grep "can't identify" >>/opt/uniisp/shell/log/10018.$$ 2>&1
/usr/sbin/lsof -p $PID | grep "identify" >>/opt/uniisp/shell/log/10018.$$ 2>&1
sleep 10
#ps -ef | grep 10018_sp_client | grep -v grep | awk '{print $2}' | xargs -n 1 -i lsof -p {} >/opt/uniisp/shell/log/1001801
if [ -s /opt/uniisp/shell/log/10018.$$ ]
then
#echo "wyk"
/opt/uniisp/shell/10018stop.sh
/opt/uniisp/shell/10018start.sh
echo "ok" >> /opt/uniisp/shell/log/10018.$$ 2>&1
fi
標的shell中的lsof之前沒有寫絕對路徑導致一直沒有輸出,導致後續程序無法執行。