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之前没有写绝对路径导致一直没有输出,导致后续程序无法执行。
#!/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之前没有写绝对路径导致一直没有输出,导致后续程序无法执行。
相关文章推荐
- okHttp使用中报Could not find method java.nio.file.Files.newOutputStreamo警告问题
- 使用javah生成C/C++头文件的误区
- Android Studio下NDK—JNI初涉
- Android简单计算器
- 采用ThinkPHP3.2.3框架开发网站快速入门
- 编程解密及动手动脑
- j2ee建立的Dynamic Web Project没有web.xml
- mysql安装三 linux源码安装mysql5.6.22
- free值减小【内存减少清理】
- Android保持屏幕常亮唤醒状态的方法
- 如果你有创业打算,一定要看
- Ubuntu解压缩zip,tar,tar.gz,tar.bz2
- 2015年大二上-数据结构-顺序表(1)-求集合并集
- ios 微信浏览器电话号码自动添加a标签
- LINUX-C文件编译依赖问题
- poj 1743 hash
- Android中使用Handler造成内存泄露的分析和解决
- linux管道机制
- winter is coming
- 运维实战案例之“Argument list too long”错误与解决方法