From: | "Marc Khayat" <marc(at)globalcarrier(dot)net> |
---|---|
To: | "Lane Van Ingen" <lvaningen(at)esncc(dot)com>, "Andrej Ricnik-Bay" <andrej(dot)groups(at)gmail(dot)com>, <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Init script |
Date: | 2005-09-26 14:56:17 |
Message-ID: | A350ED83958B6D478E5BA7BCED73818F087D8B@server.globalcarrier.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Thx, it works
Marc
-----Original Message-----
From: pgsql-novice-owner(at)postgresql(dot)org
[mailto:pgsql-novice-owner(at)postgresql(dot)org] On Behalf Of Lane Van Ingen
Sent: Friday, September 23, 2005 10:17 PM
To: Andrej Ricnik-Bay; pgsql-novice(at)postgresql(dot)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(at)postgresql(dot)org
[mailto:pgsql-novice-owner(at)postgresql(dot)org]On Behalf Of Andrej Ricnik-Bay
Sent: Friday, September 23, 2005 2:19 PM
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: [NOVICE] Init script
On 9/24/05, Marc Khayat <marc(at)globalcarrier(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Steve Tucknott | 2005-09-26 19:01:43 | Importing Later Release..... |
Previous Message | Marc Khayat | 2005-09-26 14:16:51 | Re: Init script |