-# See how we were called.
-# Every action is performed for all given (all configured by default)
-# db clusters.
-case "$action" in
- start)
- for pgdir in $DB_CLUSTERS; do
- pgstatus "$pgdir"
- if [ "$PG_STATUS" = "running" ]; then
- # pg_ctl status can misinform us about postgresql status
- # so let's check if postmaster is really alive
- if ps ax | grep -v grep | grep -q "$PG_PID"; then
- msg_already_running "PostgreSQL $pgdir"
- else
- # pg_ctl has misinformed us about postgresql status;
- # remove pid file and run postgresql
- msg_not_running "PostgreSQL $pgdir"
- rm -f $pgdir/postmaster.pid
- pgstart "$pgdir"
- fi
+start() {
+ for pgdir in $DB_CLUSTERS; do
+ pgstatus "$pgdir"
+ if [ "$PG_STATUS" = "running" ]; then
+ # pg_ctl status can misinform us about postgresql status
+ # so let's check if postmaster is really alive
+ if ps -p "$PG_PID" >/dev/null; then
+ msg_already_running "PostgreSQL $pgdir"