展会信息港展会大全

shell服务状态监控代码
来源:互联网   发布日期:2016-01-26 10:21:15   浏览:2786次  

导读: ! bin sh DBSTAT=`ps -ef|grep 39;postmaster 39;|grep -v 39;grep 39;` if [ $DBSTAT == ]; then echo DB down DBstus=`ps -ef|grep 39;postmaster 39;|grep -v ...

#!/bin/sh

DBSTAT=`ps -ef|grep 'postmaster'|grep -v 'grep'`

if [ "$DBSTAT" == "" ];

then

echo "DB down"

DBstus=`ps -ef|grep 'postmaster'|grep -v 'grep'`

while [ "$DBstus" == "" ];

do

if ["$DBstus" == ""];

then

echo "DB starting ..."

/etc/init.d/postgresql start

DBstus=`ps -ef|grep 'postmaster'|grep -v 'grep'`

else

echo "PostgreSQL already running! "

fi

done

else

echo "DB running"

fi

赞助本站

人工智能实验室

相关热词: shell 服务状态 监控

AiLab云推荐
推荐内容
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港