/[gentoo-alt]/trunk/prefix-overlay/dev-db/postgresql/files/postgresql.init-8.1.0
Gentoo

Contents of /trunk/prefix-overlay/dev-db/postgresql/files/postgresql.init-8.1.0

Parent Directory Parent Directory | Revision Log Revision Log


Revision 889 - (show annotations) (download)
Wed Nov 23 17:45:11 2005 UTC (9 years, 1 month ago) by kito
File size: 1279 byte(s)
postgresql-8.1.0 initial import.
1 #!/sbin/runscript
2 # Copyright 1999-2004 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/files/postgresql.init-8.1.0,v 1.1 2005/11/08 13:53:10 nakano Exp $
5
6 opts="${opts} reload"
7
8 depend() {
9 use net
10 }
11
12 checkconfig() {
13 if [ ! -d $PGDATA ]; then
14 eerror "directory not found: $PGDATA"
15 eerror "You should create PGDATA directory first."
16 return 1
17 fi
18 }
19
20 start() {
21 checkconfig || return 1
22
23 ebegin "Starting PostgreSQL"
24 if [ -f $PGDATA/postmaster.pid ]; then
25 rm $PGDATA/postmaster.pid
26 fi
27 su - $PGUSER -c "/usr/bin/pg_ctl start -D '$PGDATA' -s -l '$PGLOG' -o '$PGOPTS'"
28
29 while :
30 do
31 cnt=$(($cnt + 1))
32 if [ -f "$PGDATA/postmaster.pid" ]; then
33 ret=0
34 break
35 fi
36
37 if [ $cnt -eq 30 ]; then
38 eerror "Please see log file: $PGLOG"
39 ret=1
40 break
41 fi
42 sleep 1
43 done
44 eend $ret
45 }
46
47 stop() {
48 ebegin "Stopping PostgreSQL"
49 su - $PGUSER -c "/usr/bin/pg_ctl stop -D '$PGDATA' -s -m fast"
50 eend $?
51 }
52
53 svc_restart() {
54 ebegin "Restarting PostgreSQL"
55 su - $PGUSER -c "/usr/bin/pg_ctl restart -D '$PGDATA' -s -m fast -l '$PGLOG' -o '$PGOPTS'"
56 eend $?
57 }
58
59 reload() {
60 ebegin "Reloading PostgreSQL configuration"
61 su - $PGUSER -c "/usr/bin/pg_ctl reload -D '$PGDATA' -s"
62 eend $?
63 }

  ViewVC Help
Powered by ViewVC 1.1.20