mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Make it reasonably safe to use pg_ctl to start the postmaster from a boot-time
script. To do this, have pg_ctl pass down its parent shell's PID in an environment variable PG_GRANDPARENT_PID, and teach CreateLockFile() to disregard that PID as a false match if it finds it in postmaster.pid. This allows us to cope with one level of postgres-owned shell process even with pg_ctl in the way, so it's just as safe as starting the postmaster directly. You still have to be careful about how you write the initscript though. Adjust the comments in contrib/start-scripts/ to not deprecate use of pg_ctl. Also, fix the ROTATELOGS option in the OSX script, which was indulging in exactly the sort of unsafe coding that renders this fix pointless :-(. A pipe inside the "sudo" will probably result in more than one postgres-owned process hanging around.
This commit is contained in:
@ -24,7 +24,7 @@
|
||||
|
||||
# Original author: Ryan Kirkpatrick <pgsql@rkirkpat.net>
|
||||
|
||||
# $PostgreSQL: pgsql/contrib/start-scripts/linux,v 1.8 2006/07/13 14:44:33 petere Exp $
|
||||
# $PostgreSQL: pgsql/contrib/start-scripts/linux,v 1.9 2009/08/27 16:59:38 tgl Exp $
|
||||
|
||||
## EDIT FROM HERE
|
||||
|
||||
@ -45,9 +45,9 @@ PGLOG="$PGDATA/serverlog"
|
||||
# The path that is to be used for the script
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
# What to use to start up the postmaster (we do NOT use pg_ctl for this,
|
||||
# as it adds no value and can cause the postmaster to misrecognize a stale
|
||||
# lock file)
|
||||
# What to use to start up the postmaster. (If you want the script to wait
|
||||
# until the server has started, you could use "pg_ctl start -w" here.
|
||||
# But without -w, pg_ctl adds no value.)
|
||||
DAEMON="$prefix/bin/postmaster"
|
||||
|
||||
# What to use to shut down the postmaster
|
||||
|
Reference in New Issue
Block a user