Linux 进程守护脚本

Linux 进程守护脚本,第1张

概述一、进程守护脚本: while true; do server=`ps aux | grep stat-agent-1.0.0-SNAPSHOT.jar | grep -v grep` if [ !

一、进程守护脚本:

while true;do        server=`ps aux | grep stat-agent-1.0.0-SNAPSHOT.jar | grep -v grep`        if [ ! "$server" ]; then           systemctl start statagent.service        fi        sleep 20done

二、开机启动进程守护:

1.创建文件
cd /etc/init.d
vim daemon-stat-agent

2.文件内容
#!/bin/sh
#chkconfig: 2345 10 20
#description: daemon-stat-agent

cd /usr/local/stathub
nohup ./daemon-stat-agent.sh &

3.设置执行权限
chmod +x daemon-stat-agent

4.添加开机启动任务
chkconfig --add daemon-stat-agent

5.查看开机启动任务
chkconfig --List

 

总结

以上是内存溢出为你收集整理的Linux 进程守护脚本全部内容,希望文章能够帮你解决Linux 进程守护脚本所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/yw/1012874.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存