diff --git a/postgresql/README b/postgresql/README index e1e2bc0bd..3b2d97e04 100644 --- a/postgresql/README +++ b/postgresql/README @@ -17,9 +17,7 @@ Example: (for your convenience, there could be better ways to # mkdir /var/pgsql/data # chown postgres /var/pgsql/data -# su - postgres -# initdb -D /var/pgsql/data -# exit +# sudo -u postgres initdb -D /var/pgsql/data # /etc/rc.d/postgresql start # psql -U postgres -f pg.dump postgres @@ -33,21 +31,18 @@ NEW INSTALL To complete the installation and create a test database you need to do some additional steps: -# useradd -m -d /home/postgres postgres +# useradd -m -d /home/postgres -s /bin/false postgres # passwd -l postgres # mkdir -p /var/pgsql/data # touch /var/log/postgresql # chown postgres /var/pgsql/data /var/log/postgresql -# su - postgres -# initdb -D /var/pgsql/data -# exit +# sudo -u postgres initdb -D /var/pgsql/data # /etc/rc.d/postgresql start -# su - postgres -# createdb test -# psql test +# sudo -u postgres createdb test +# psql -U postgres test Edit /etc/cron/weekly/syslog as root and add a line "/usr/sbin/rotatelog postgresql" diff --git a/postgresql/postgresql b/postgresql/postgresql index bde3f5dd8..cdad86a5f 100644 --- a/postgresql/postgresql +++ b/postgresql/postgresql @@ -6,7 +6,7 @@ PG_DATA=/var/pgsql/data case "$1" in start|stop|status|restart|reload) - su - postgres -c "pg_ctl -D $PG_DATA -l /var/log/postgresql $1" + sudo -u postgres pg_ctl -D "$PG_DATA" -l /var/log/postgresql "$1" ;; *) echo "usage: $0 start|stop|restart|reload|status"