shell 服务状态监控

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

附件:http://down.51cto.com/data/2362362


本文转自 pgmia 51CTO博客,原文链接:http://blog.51cto.com/heyiyi/1144245


上一篇:Spring Security(16)——基于表达式的权限控制


下一篇:机房收费系统之防止SQL注入