Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
cf21985a
Commit
cf21985a
authored
24 years ago
by
Peter Eisentraut
Browse files
Options
Downloads
Patches
Plain Diff
Update section about how to start server from boot scripts.
parent
fdf87fdf
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/src/sgml/runtime.sgml
+60
-42
60 additions, 42 deletions
doc/src/sgml/runtime.sgml
with
60 additions
and
42 deletions
doc/src/sgml/runtime.sgml
+
60
−
42
View file @
cf21985a
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.
49
2001/02/
09 20:38
:1
5
petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.
50
2001/02/
10 00:50
:1
8
petere Exp $
-->
<Chapter Id="runtime">
...
...
@@ -164,6 +164,20 @@ NOTICE: Initializing database with en_US collation order.
must also specify the <option>-i</option> option.
</para>
<para>
This shells syntax can get tedious quickly. Therefore the shell
script wrapper <application>pg_ctl</application> is provided that
encapsulates some of the tasks. E.g.,
<programlisting>
pg_ctl start -l logfile
</programlisting>
will start the server in the background and put the output into the
named log file. The <option>-D</option> option has the same
meaning as when invoking postmaster directly.
<application>pg_ctl</application> also implements a symmetric
<quote>stop</quote> operation.
</para>
<para>
Normally, you will want to start the database server when the
computer boots up. This is not required; the
...
...
@@ -178,66 +192,77 @@ NOTICE: Initializing database with en_US collation order.
with them. Many systems have a file
<filename>/etc/rc.local</filename> or
<filename>/etc/rc.d/rc.local</filename> which is almost certainly
no bad place to put such a command. Whatever you do,
postmast
er
no bad place to put such a command. Whatever you do,
the serv
er
must be run by the <productname>Postgres</productname> user account
<emphasis>and not by root</emphasis> or any other user. Therefore
you probably always want to form your command lines along the lines
of <literal>su -c '...' postgres</literal>, for example:
<programlisting>
nohup
su -c 'p
ostmaster
-D /usr/local/pgsql/data
>
server
.
log
2>&1
' postgres
&
su -c 'p
g_ctl
-D /usr/local/pgsql/data
-l
serverlog' postgres
</programlisting>
(using the program <application>nohup</application> to prevent the
server from dying when you log out).
</para>
<para>
Here are a few more operating system specific suggestions.
Here are a few more operating system specific suggestions. (Always
replace the proper installation directory and the user name you
chose.)
<itemizedlist>
<listitem>
<para>
Edit the file <filename>rc.local</filename> on
<productname>NetBSD</productname> or file
<filename>rc2.d</filename> on <productname>Solaris</productname> to contain the
following single line:
For <productname>FreeBSD</productname>, take a look at the file
<filename>contrib/start-scripts/freebsd</filename> in the
<productname>PostgreSQL</productname> source distribution.
</para>
</listitem>
<listitem>
<para>
On <productname>OpenBSD</productname>, add the following lines
to the file <filename>/etc/rc.local</filename>:
<programlisting>
su postgres -c "/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data"
if [ -x /usr/local/pgsql/bin/pg_ctl -a -x /usr/local/pgsql/bin/postmaster ]; then
su - -c '/usr/local/pgsql/bin/pg_ctl start -l /var/postgresql/log -s' postgres
echo -n ' postgresql'
fi
</programlisting>
</para>
</listitem>
<listitem>
<para>
On <productname>FreeBSD</productname> edit
<filename>/usr/local/etc/rc.d/pgsql.sh</filename> to contain the
following lines and make it <literal>chmod 755</literal> and
<literal>chown root:bin</literal>.
On <productname>Linux</productname> systems either add
<programlisting>
#!/bin/sh
[ -x /usr/local/pgsql/bin/postmaster ] && {
su -l pgsql -c 'exec /usr/local/pgsql/bin/postmaster
-D/usr/local/pgsql/data
-S -o -F > /usr/local/pgsql/errlog' &
echo -n ' pgsql'
}
/usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgsql/data
</programlisting>
You may put the line breaks as shown above. The shell is smart
enough to keep parsing beyond end-of-line
i
f
the
re is an
expression unfinished. The exec saves one layer of shell under
the postmaster process so the parent is init
.
to <filename>/etc/rc.d/rc.local</filename> or look into the file
<filename>contrib/start-scripts/linux</filename>
i
n
the
<productname>PostgreSQL</productname> source distribution to
integrate the start and shutdown into the run level system
.
</para>
</listitem>
<listitem>
<para>
On <productname>RedHat Linux</productname> add a file
<filename>/etc/rc.d/init.d/postgres.init</filename>
which is based on the example in <filename>contrib/linux/</filename>.
Then make a softlink to this file from
<filename>/etc/rc.d/rc5.d/S98postgres.init</filename>.
On <productname>NetBSD</productname>, either use the
<productname>FreeBSD</productname> or
<productname>Linux</productname> start scripts, depending on
preference, as an example and place the file at
<filename>/usr/local/etc/rc.d/postgresql</filename>.
</para>
</listitem>
<listitem>
<para>
On <productname>Solaris</productname>, edit the file
<filename>rc2.d</filename> to contain the following single line:
<programlisting>
su - postgres -c "/usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgsql/data"
</programlisting>
</para>
</listitem>
</itemizedlist>
</para>
<para>
...
...
@@ -248,13 +273,6 @@ su postgres -c "/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data"
shutting down the postmaster.
</para>
<para>
The shell script wrapper <application>pg_ctl</application> that
comes with <productname>Postgres</productname> can also be used to
control starting (and stopping!) of the database server in
intelligent fashion.
</para>
<sect2 id="postmaster-start-failures">
<title>Server Start-up Failures</title>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment