diff options
author | jlam <jlam> | 2000-12-11 20:18:56 +0000 |
---|---|---|
committer | jlam <jlam> | 2000-12-11 20:18:56 +0000 |
commit | ac505c7ddd879b39c039f32df33cd9efc14747c8 (patch) | |
tree | d6fd10355f8a6c4cb6b38ac5587ce82e66bb4219 /databases/postgresql/files | |
parent | b07fde8117ec2d12f2d61a5a705382babe70662e (diff) | |
download | pkgsrc-ac505c7ddd879b39c039f32df33cd9efc14747c8.tar.gz |
Rename this script to pgsql.sh, make this script a bit more complete
and robust, and add example command_args setting to allow TCP/IP
connections to the PostgreSQL database.
Diffstat (limited to 'databases/postgresql/files')
-rw-r--r-- | databases/postgresql/files/pgsql.sh | 57 | ||||
-rw-r--r-- | databases/postgresql/files/pgsql.sh.tmpl | 39 |
2 files changed, 57 insertions, 39 deletions
diff --git a/databases/postgresql/files/pgsql.sh b/databases/postgresql/files/pgsql.sh new file mode 100644 index 00000000000..4fd0a2d9ae5 --- /dev/null +++ b/databases/postgresql/files/pgsql.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# +# $NetBSD: pgsql.sh,v 1.1 2000/12/11 20:18:57 jlam Exp $ +# +# PostgreSQL database rc.d control script +# +# PROVIDE: pgsql +# REQUIRE: DAEMON + +name="postgres" +ctl_command="@PREFIX@/bin/pg_ctl" +command="@PREFIX@/bin/postmaster" +command_args="-S -o -F" # start in silent mode and disable + # automatic fsync after each + # transaction +#command_args="-S -i -o -F" # as above, but also allows TCP/IP + # connections + +USER="@PGUSER@" +PGHOME="@PREFIX@/${USER}" +SU="@SU@" + +cmd=${1:-start} + +if [ -x ${ctl_command} -a -x ${command} ] +then + case ${cmd} in + restart) + echo "Restarting ${name}." + echo "exec ${ctl_command} restart >> ${PGHOME}/errlog" \ + | ${SU} -l ${USER} + ;; + + start) + echo "Starting ${name}." + echo "exec ${ctl_command} \ + -p ${command} -o \"${command_args}\" start" \ + | ${SU} -l ${USER} + ;; + + stop) + echo "Stopping ${name}." + echo "exec ${ctl_command} stop >> ${PGHOME}/errlog" \ + | ${SU} -l ${USER} + ;; + + status) + echo "exec ${ctl_command} status" \ + | ${SU} -l ${USER} + ;; + + *) + echo 1>&2 "Usage: $0 [restart|start|stop|status]" + exit 1 + ;; + esac +fi diff --git a/databases/postgresql/files/pgsql.sh.tmpl b/databases/postgresql/files/pgsql.sh.tmpl deleted file mode 100644 index dac496d6244..00000000000 --- a/databases/postgresql/files/pgsql.sh.tmpl +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# -# $NetBSD: pgsql.sh.tmpl,v 1.9 2000/12/07 16:56:40 jlam Exp $ -# FreeBSD Id: pgsql.sh.tmpl,v 1.3 1997/10/05 21:00:49 andreas Exp -# -# pgsql.sh - postgresql startup file for NetBSD -# -# PROVIDE: pgsql -# REQUIRE: DAEMON - -CMD=${1:-start} -USER=@PGUSER@ -PGHOME=@PREFIX@/${USER} - -if [ -x @PREFIX@/bin/postmaster -a -x @PREFIX@/bin/pg_ctl ] -then - case ${CMD} in - start) - echo -n ' pgsql' - su -l ${USER} -c 'exec @PREFIX@/bin/pg_ctl \ - -p @PREFIX@/bin/postmaster -o "-S -o -F" start \ - > ${PGHOME}/errlog' - ;; - stop) - su -l ${USER} -c 'exec @PREFIX@/bin/pg_ctl stop \ - >> ${PGHOME}/errlog' - ;; - restart) - su -l ${USER} -c 'exec @PREFIX@/bin/pg_ctl restart \ - >> ${PGHOME}/errlog' - ;; - status) - su -l ${USER} -c 'exec @PREFIX@/bin/pg_ctl status' - ;; - *) - echo "Unexpected argument: ${CMD}" - ;; - esac -fi |