您的位置:首页 > 其它

LSOF命令在crontab中无法执行解决方法

2015-10-22 12:33 344 查看
相关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之前没有写绝对路径导致一直没有输出,导致后续程序无法执行。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息