Re: How to check postgres running or not ?
От | Reiner Dassing |
---|---|
Тема | Re: How to check postgres running or not ? |
Дата | |
Msg-id | 414E84A3.8020200@wettzell.ifag.de обсуждение исходный текст |
Ответ на | How to check postgres running or not ? ("Sandeep Gaikwad" <sgaikwad@vertex.co.in>) |
Список | pgsql-sql |
Hello! Our check procedure on TRU64 UNIX is: checkmasterdaemon if [ $? -eq 1 ]; then # Try to connect to postgres by selecting tables TABELLEN=`/pg/postgresql-7.4.3/bin/psql-h postgres -c 'select datname from pg_database' postgres postgres 2>/dev/null` if [[ "X$TABELLEN" = "X" ]];then echo "check failed for postmaster" exit 1 else # echo"postmaster is running" fi else echo "check failed for postmaster" exit 1 fi where : checkmasterdaemon () { MASTER_PID=$(getmasterpid) if [ "X$MASTER_PID" = "X" ]; then #echo "Postmaster is not running" ret=0 else PS_OUT=`ps -o comm,pid-p "${MASTER_PID}"` PID=`echo $PS_OUT | awk '/postgres/ {print $4}'` #echo $PID if [ "X$MASTER_PID"!= "X$PID" ] then #echo "Postmaster (${MASTER_PID}) does not exist (any more)" ret=0 else ret=1 fi fi return $ret } getmasterpid () { if [[ -r ${PIDFILE} ]] then MASTER_PID=`head -n 1 ${PIDFILE}` echo $MASTER_PID else echo "" fi } -- Mit freundlichen Gruessen / With best regards Reiner Dassing
В списке pgsql-sql по дате отправления: