shell 服务状态监控
2014-09-05来源:

#!/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

更多信息请查看IT技术专栏

2025公考·省考培训课程试听预约报名

  • 报班类型
  • 姓名
  • 手机号
  • 验证码
推荐信息
Baidu
map