shell脚本检查进程是否启动
2010-05-10 16:26
309 查看
转载一篇文章,感觉以后会用到,思路很好,俺是初学者,嘿嘿
#author:eggplant
#Date:2009-09-17
# ---- Start ----
nap_patch="/home/gwdev/StdServer/"
nap_count="`ps -ef|grep StdServer|grep -v 'grep'|wc -l`"
if [ $nap_count -gt 0 ]
then
echo "StdServer is start! `date`" >>/home/gwdev/StdServer/runState.log
else
cd $nap_patch
sh run.sh &
echo "StdServer is stop,Now Start Nap! `date`" >>/home/gwdev/StdServer/runState.log
fi
# ---- End ----
然后将这个脚本加入任务可以使用crontab -e
*/1 * * * * /home/gwdev/StdServer/StbListener.sh
设置为一分钟执行一次~
#author:eggplant
#Date:2009-09-17
# ---- Start ----
nap_patch="/home/gwdev/StdServer/"
nap_count="`ps -ef|grep StdServer|grep -v 'grep'|wc -l`"
if [ $nap_count -gt 0 ]
then
echo "StdServer is start! `date`" >>/home/gwdev/StdServer/runState.log
else
cd $nap_patch
sh run.sh &
echo "StdServer is stop,Now Start Nap! `date`" >>/home/gwdev/StdServer/runState.log
fi
# ---- End ----
然后将这个脚本加入任务可以使用crontab -e
*/1 * * * * /home/gwdev/StdServer/StbListener.sh
设置为一分钟执行一次~
相关文章推荐
- shell脚本检查某个进程是否正常,如果不正常则自动启动
- 用shell脚本监控进程是否存在 不存在则启动的实例
- shell 脚本监控程序是否正在执行, 如果没有执行, 则自动启动该进程
- shell脚本检查服务是否启动脚本
- 用shell脚本监控进程是否存在 不存在则启动的实例
- 用shell脚本监控进程是否存在 不存在则启动的实例
- shell 脚本监控程序是否正在执行, 如果没有执行, 则自动启动该进程
- 用shell脚本监控进程是否存在 不存在则启动的实例
- 用shell脚本监控进程是否存在 不存在则启动的实例
- 用shell脚本监控进程是否存在 不存在则启动的实例
- 用shell脚本监控进程是否存在 不存在则启动的实例
- 用shell脚本监控进程是否存在 不存在则启动的实例
- 用shell脚本监控进程是否存在 不存在则启动的实例
- 用shell脚本监控进程是否存在 不存在则启动的实例
- 用shell脚本监控进程是否存在 不存在则启动的实例
- 用shell脚本监控进程是否存在 不存在则启动的实例
- 用shell脚本监控进程是否存在 不存在则启动的实例
- 用shell脚本监控进程是否存在 不存在则启动的实例
- shell脚本--检查文件是否存在
- 定时检查进程的shell脚本