]> granicus.if.org Git - postgresql/commitdiff
Fix examples of how to use "su" while starting the server.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 25 Sep 2012 17:53:05 +0000 (13:53 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 25 Sep 2012 17:53:05 +0000 (13:53 -0400)
The syntax "su -c 'command' username" is not accepted by all versions of
su, for example not OpenBSD's.  More portable is "su username -c
'command'".  So change runtime.sgml to recommend that syntax.  Also,
add a -D switch to the OpenBSD example script, for consistency with other
examples.  Per Denis Lapshin and Gábor Hidvégi.

doc/src/sgml/runtime.sgml

index 3645d4c5a92dc026914a6dc95853a56a73051add..ef1cdfd4145a7031e53e2cc7de4e1fb964bac960 100644 (file)
@@ -280,10 +280,10 @@ pg_ctl start -l logfile
    <filename>rc.d</> directories. Whatever you do, the server must be
    run by the <productname>PostgreSQL</productname> user account
    <emphasis>and not by root</emphasis> or any other user. Therefore you
-   probably should form your commands using <literal>su -c '...'
-   postgres</literal>.  For example:
+   probably should form your commands using
+   <literal>su postgres -c '...'</literal>.  For example:
 <programlisting>
-su -c 'pg_ctl start -D /usr/local/pgsql/data -l serverlog' postgres
+su postgres -c 'pg_ctl start -D /usr/local/pgsql/data -l serverlog'
 </programlisting>
   </para>
 
@@ -309,7 +309,7 @@ su -c 'pg_ctl start -D /usr/local/pgsql/data -l serverlog' postgres
       <indexterm><primary>OpenBSD</><secondary>start script</secondary></>
 <programlisting>
 if [ -x /usr/local/pgsql/bin/pg_ctl -a -x /usr/local/pgsql/bin/postgres ]; then
-    su - -c '/usr/local/pgsql/bin/pg_ctl start -l /var/postgresql/log -s' postgres
+    su -l postgres -c '/usr/local/pgsql/bin/pg_ctl start -s -l /var/postgresql/log -D /usr/local/pgsql/data'
     echo -n ' postgresql'
 fi
 </programlisting>