Skip to content

Commit cf78eb4

Browse files
committed
Fix examples of how to use "su" while starting the server.
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.
1 parent 22cdae9 commit cf78eb4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

doc/src/sgml/runtime.sgml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,10 @@ pg_ctl start -l logfile
280280
<filename>rc.d</> directories. Whatever you do, the server must be
281281
run by the <productname>PostgreSQL</productname> user account
282282
<emphasis>and not by root</emphasis> or any other user. Therefore you
283-
probably should form your commands using <literal>su -c '...'
284-
postgres</literal>. For example:
283+
probably should form your commands using
284+
<literal>su postgres -c '...'</literal>. For example:
285285
<programlisting>
286-
su -c 'pg_ctl start -D /usr/local/pgsql/data -l serverlog' postgres
286+
su postgres -c 'pg_ctl start -D /usr/local/pgsql/data -l serverlog'
287287
</programlisting>
288288
</para>
289289

@@ -309,7 +309,7 @@ su -c 'pg_ctl start -D /usr/local/pgsql/data -l serverlog' postgres
309309
<indexterm><primary>OpenBSD</><secondary>start script</secondary></>
310310
<programlisting>
311311
if [ -x /usr/local/pgsql/bin/pg_ctl -a -x /usr/local/pgsql/bin/postgres ]; then
312-
su - -c '/usr/local/pgsql/bin/pg_ctl start -l /var/postgresql/log -s' postgres
312+
su -l postgres -c '/usr/local/pgsql/bin/pg_ctl start -s -l /var/postgresql/log -D /usr/local/pgsql/data'
313313
echo -n ' postgresql'
314314
fi
315315
</programlisting>

0 commit comments

Comments
 (0)