diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-08-27 16:59:38 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-08-27 16:59:38 +0000 |
commit | 8f5500e6bdb4d42ea9620b0f515671be7d681bf6 (patch) | |
tree | ee566993694a99187df4837355addbf633ae3372 /contrib/start-scripts/linux | |
parent | 0e3f0cbddcb6da390c1accc5fc6af4eedd33b6a2 (diff) | |
download | postgresql-8f5500e6bdb4d42ea9620b0f515671be7d681bf6.tar.gz |
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.
Diffstat (limited to 'contrib/start-scripts/linux')
-rw-r--r-- | contrib/start-scripts/linux | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/start-scripts/linux b/contrib/start-scripts/linux index f1feb34f94..6d6ff2aed9 100644 --- a/contrib/start-scripts/linux +++ b/contrib/start-scripts/linux @@ -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 |