shell判断进程是否存在
#!/bin/bash
#进入rest所有目录,后续在此目录执行动作
cd /data/www/vhosts/go/
#rest的进程数,由于脚本名称为restart_rest.sh,所以排除了对restart_rest的搜索
n=`ps -ef|grep rest|grep -v grep|grep -v restart_rest|wc -l`
-eq $n ]; then
#进程不存在
echo "rest进程不存在"
#nohup ./rest > /dev/>& &
else
#rest进程存在,杀掉进程
echo "rest进程已存在,杀掉进程"
fi
echo "rest启动服务"#使用nohup在后台执行服务
nohup ./rest > /dev/>& &
shell判断进程是否存在的更多相关文章
- Shell实现判断进程是否存在并重新启动脚本
Shell实现判断进程是否存在并重新启动脚本 - superbfly的专栏 - CSDN博客 https://blog.csdn.net/superbfly/article/details/52513 ...
- Python3判断shell下进程是否存在&&启动&&邮件通知
判断进程是否存在 def isRunning(process_name): try: process = len(os.popen('ps aux | grep "' + process_n ...
- shell判断条件整理
1.字符串判断 str1 = str2 当两个字符串串有相同内容.长度时为真 str1 != str2 当字符串str1和str2不等时为真 -n str1 当字符串的长度大于0时为真(串非空) -z ...
- [转]使用 Shell 对进程资源进行监控
原文:http://www.ibm.com/developerworks/cn/linux/l-cn-shell-monitoring/ 使用 Shell 对进程资源进行监控 检查进程是否存在 在 对 ...
- Unix shell判断和比较
1. shell 的$! ,$?, $$,$@ $n $1 the first parameter,$2 the second... $# The number of c ...
- shell判断和比较
http://blog.chinaunix.net/uid-7553302-id-183648.html 1 shell 的$! ,$?, $$,$@ $n $1 the first ...
- shell浅谈之九子shell与进程处理
转自:http://blog.csdn.net/taiyang1987912/article/details/39529291 版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[+] ...
- Bash Shell 获取进程 PID
转载地址:http://weyo.me/pages/techs/linux-get-pid/ 导读 Linux 的交互式 Shell 与 Shell 脚本存在一定的差异,主要是由于后者存在一个独立的运 ...
- shell判断文件是否存在
转自:http://www.cnblogs.com/sunyubo/archive/2011/10/17/2282047.html 1. shell判断文件,目录是否存在或者具有权限 2. #!/bi ...
随机推荐
- 【长期更新】迈向现代化的 .Net 配置指北
1. 欢呼 .NET Standard 时代 我现在已不大提 .Net Core,对于我来说,未来的开发将是基于 .NET Standard,不仅仅是 面向未来 ,也是 面向过去:不只是 .Net C ...
- python format() 函数
转载 https://www.cnblogs.com/wushuaishuai/p/7687728.html 正文 Python2.6 开始,新增了一种格式化字符串的函数 format() ,它增强了 ...
- 微信退款验证证书时报错:length too long
由于springboot文件加载时,默认会加载resources目录下的文件,而微信的证书刚好在它之下,加载时就会报这个错误.解决办法: 在pom.xml文件中,添加如下代码: <plugin& ...
- 解决cuvid中的sample编译和链接问题
unzip Video_Codec_SDK_9.0.20.zip cd Video_Codec_SDK_9.0.20/Samples/AppDecode/AppDecImageProvider vi ...
- MFC:定时器
1. 定时器设置 API:CWnd::SetTimer() 函数原型:UINT SetTimer(UINT nIDEvent, UINT nElapse, void (CALLBACK EXP ...
- static_assert与assert
C++0x中引入了static_assert这个关键字,用来做编译期间的断言,因此叫做静态断言. 其语法:static_assert(常量表达式,提示字符串). 如果第一个参数常量表达式的值为fals ...
- 把xml数据直接插入到sqlserver数据库
存储过程: ALTER proc [ali].[ins_冻结金额表] @xmldoc varchar(max), ) as declare @idoc int exec sp_xml_prepared ...
- JGUI源码:实现蒙版层显示(18)
有的时候需要显示一个蒙版层,蒙版层显示的主要原理是在指定元素比如div上创建一个子元素div,设置absolute.宽高100%.设置z-index置于顶层,设置半透明效果,fadein,fadeou ...
- 面试经验合集-Web前端<一>
面试一:MF时间:2019-1-2 试题一 // [mf: stringify-query-string] // 类型: x z // 时长: 15 分钟 // 姓名: // 日期: // 实现下面的 ...
- 《Link Prediction with Personalized Social Influence》论文解读
论文:Huo, Zepeng, Xiao Huang, and Xia Hu. "Link Prediction with Personalized Social Influence.&qu ...