#!/usr/local/bin/tclsh8.3 set PID_F /usr/local/pgsql/data/postmaster.pid if [file exists $PID_F] { set pid [lindex [split [exec cat $PID_F] \n] 0] set exists [string length [exec ps ax | awk "\$1 == $pid {print}"]] if !$exists { exec rm $PID_F exec logger "pg_rmpid: invalid pid; removed $PID_F" } }
Do you call this at the beginning of the startup portion of your Postgres startup script?