Re: Init script - Mailing list pgsql-novice
From | Marc Khayat |
---|---|
Subject | Re: Init script |
Date | |
Msg-id | A350ED83958B6D478E5BA7BCED73818F087D8B@server.globalcarrier.net Whole thread Raw |
In response to | Init script ("Marc Khayat" <marc@globalcarrier.net>) |
List | pgsql-novice |
Thx, it works Marc -----Original Message----- From: pgsql-novice-owner@postgresql.org [mailto:pgsql-novice-owner@postgresql.org] On Behalf Of Lane Van Ingen Sent: Friday, September 23, 2005 10:17 PM To: Andrej Ricnik-Bay; pgsql-novice@postgresql.org Subject: Re: [NOVICE] Init script This one works for us .... #!/bin/sh # Start/stop/restart postgresql. # # To start PostgreSQL automatically at boot, be sure this script is executable: # chmod 755 /etc/rc.d/rc.postgres # --> Before you can run PostgreSQL, you must have a database. Use initd. # # Note that step one is becoming the 'postgres' user. It's important to do this # before making any changes to the database, or postgres won't be able to write # to it later # Set up variables PGROOT=/usr/local/pgsql PGDATA=/usr/local/pgsql/data PGUSER=postgres PGLOG="$PGDATA/postgres.log" PGDAEMON="$PGROOT/bin/postmaster" PGCTL="$PGROOT/bin/pg_ctl" if echo '\c' | grep -s c >/dev/null 2>%1; then ECHO_N="echo -n" ECHO_C="" else ECHO_N="echo" ECHO_C='\c' fi set -e # Start postgresql: postgresql_start() { $ECHO_N "Starting PostgreSQL: "$ECHO_C su - $PGUSER -c "$PGDAEMON -D '$PGDATA' &" >>$PGLOG 2>&1 echo "ok" } # Stop postgresql: postgresql_stop() { $ECHO_N "Stopping PostgreSQL: "$ECHO_C su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast" >>$PGLOG 2>&1 echo "ok" } # Restart postgreSQL: postgresql_restart() { $ECHO_N "Restarting PostgreSQL: "$ECHO_C su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast" >>$PGLOG 2>&1 echo "ok" su - $PGUSER -c "$PGDAEMON -D '$PGDATA' &" >>$PGLOG 2>&1 echo "ok" } case "$1" in 'start') postgresql_start ;; 'stop') postgresql_stop ;; 'restart') postgresql_restart ;; *) echo "Usage $0 {start|stop|restart}" 1>&2 exit 1 ;; esac exit 0 -----Original Message----- From: pgsql-novice-owner@postgresql.org [mailto:pgsql-novice-owner@postgresql.org]On Behalf Of Andrej Ricnik-Bay Sent: Friday, September 23, 2005 2:19 PM To: pgsql-novice@postgresql.org Subject: Re: [NOVICE] Init script On 9/24/05, Marc Khayat <marc@globalcarrier.net> wrote: > Anyone can provide the init script (that resides in /etc/rc.d/ini.t) for > Postgresql-8.0.3? it's installed in /usr/local/pgsql Can't you find the one from your RPM? ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings
pgsql-novice by date: