WEB开发网
开发学院软件开发Shell shell 服务状态监控 阅读

shell 服务状态监控

 2013-03-04 13:51:34 来源:WEB开发网   
核心提示: #!/bin/shDBSTAT=`ps -ef|grep 'postmaster'|grep -v 'grep'`if [ "$DBSTAT" == "" ];thenecho "DB down" DBstus=`ps -ef

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

Tags:shell 服务 状态

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接