updated on Thu Jan 19 20:01:47 UTC 2012
[aur-mirror.git] / postgresql84-libs / postgresql84
bloba72ae960f5a3b0b617f5aa3f8e610aedebbe0cd5
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
5 . /etc/conf.d/postgresql84
7 PG_CTL="/usr/${_PQDIR}/bin/pg_ctl $PGOPTS -D $PGROOT/data -l /var/log/postgresql84.log -s -w"
9 case "$1" in
10 start)
11 stat_busy "Starting PostgreSQL 8.4"
12 # initialization
13 if [ ! `egrep '^postgres:' /etc/group` ]; then
14 stat_busy "Adding postgres group"
15 groupadd -g 88 postgres
16 stat_done
18 if [ ! `egrep '^postgres:' /etc/passwd` ]; then
19 stat_busy "Adding postgres user"
20 useradd -u 88 -g postgres -d $PGROOT -s /bin/bash postgres
21 [ -d $PGROOT ] && chown -R postgres.postgres $PGROOT
22 stat_done
24 if [ ! -d $PGROOT ]; then
25 mkdir -p $PGROOT/data && chown -R postgres.postgres $PGROOT
26 su - postgres -c "/usr/${_PQDIR}/bin/initdb $INITOPTS -D $PGROOT/data"
28 if [ ! -e /var/log/postgresql84.log ]; then
29 touch /var/log/postgresql84.log
30 chown postgres /var/log/postgresql84.log
32 # start the process
33 su - postgres -c "$PG_CTL start"
34 if [ $? -gt 0 ]; then
35 stat_fail
36 else
37 add_daemon postgresql84
38 stat_done
41 stop)
42 stat_busy "Stopping PostgreSQL 8.4"
43 su - postgres -c "$PG_CTL stop -m fast"
44 if [ $? -gt 0 ]; then
45 stat_fail
46 else
47 rm_daemon postgresql84
48 stat_done
51 restart)
52 $0 stop
53 sleep 3
54 $0 start
57 echo "usage: $0 {start|stop|restart}"
58 esac
59 exit 0