From: | Ruslan A Dautkhanov <rusland(at)scn(dot)ru> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | postgresql-[any version] from FreeBSD ports - startup problems after crash |
Date: | 2006-05-15 08:34:16 |
Message-ID: | 44683D08.7040608@scn.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hello !
Server rebooted occasionally after power failure.
And I have stale postmaster.pid file, so postmaster didn't start with error
bill postgres[600]: [1-1] FATAL: file "postmaster.pid" already exists
I think startup script and/or pg_ctl have to be written to check if that
process really exists
and it is postmaster, so DBMS server starts after any hard reboot.
I changed the startup script block
postgresql_command()
{
su -l ${postgresql_user} -c "exec ${command} ${command_args}
${rc_arg}"
}
to
postgresql_cmd()
{
su -l ${postgresql_user} -c "exec ${command} ${command_args}
${rc_arg}"
}
postgresql_command()
{
if [ ".$1" = ".start" ]; then
pidfile="${postgresql_data}/postmaster.pid"
if [ -e ${pidfile} ]; then
#check if postmaster process really exists
pid_fromfile=`head -1 ${pidfile}`
real_pid=`ps ax | grep -v grep | grep postmaster
| grep ${postgresql_data} | awk '{print $1}'`
if [ "x${pid_fromfile}" = "x${real_pid}" ]; then
echo "Postmater for datadir
${postgresql_data} already run with pid $real_pid"
else
#we have stale pidfile, remove it
unlink $pidfile
#and run postmater safely
postgresql_cmd
fi
else
#.pid file not exists, clean startup
postgresql_cmd
fi
else
postgresql_cmd
fi
}
That I hope satisfy all cases with stale .pid file...
--
Ruslan A Dautkhanov
From | Date | Subject | |
---|---|---|---|
Next Message | Tomasz Ostrowski | 2006-05-15 10:51:57 | Re: SIGSEGV happens over once a day |
Previous Message | Jason Kankiewicz | 2006-05-14 16:07:44 | BUG #2439: pgAdmin III v1.4.1 fails to compile with GCC 4.1.0 |