diff options
author | Ying-Chieh Liao <ijliao@FreeBSD.org> | 2002-04-11 04:58:11 +0000 |
---|---|---|
committer | Ying-Chieh Liao <ijliao@FreeBSD.org> | 2002-04-11 04:58:11 +0000 |
commit | b345761190ed0484cf7adb45e7e11d985229c85c (patch) | |
tree | 2c7f116960dbf41f955c5ffafdefdd4669cba10d /databases/postgresql91-server/files | |
parent | 890f2760095f1651925dedd7799d8d66097dc941 (diff) | |
download | ports-b345761190ed0484cf7adb45e7e11d985229c85c.tar.gz ports-b345761190ed0484cf7adb45e7e11d985229c85c.zip |
Notes
Diffstat (limited to 'databases/postgresql91-server/files')
6 files changed, 62 insertions, 54 deletions
diff --git a/databases/postgresql91-server/files/502.pgsql b/databases/postgresql91-server/files/502.pgsql index 160de10370e0..32d473826f40 100644 --- a/databases/postgresql91-server/files/502.pgsql +++ b/databases/postgresql91-server/files/502.pgsql @@ -11,6 +11,20 @@ # In public domain, do what you like with it, # and use it at your own risk... :) # +############################ + +# arguments to pg_dump +PGDUMP_ARGS="-b -F c" + +# the directory where the backups will reside +# ${HOME} is pgsql's home directory +PGBACKUPDIR=${HOME}/backups + +# some data is amazingly more compressed with bzip2, esp. blobs, it seems +# if your're short on diskspace, give it a try and set USEBZIP=yes +USEBZIP=no + +############################ DIR=`dirname $0` progname=`basename $0` @@ -19,58 +33,56 @@ PRG=`cd $DIR; pwd `/$progname # Run as user pgsql if [ `id -un` != pgsql ]; then su -l pgsql -c ${PRG} - exit 0 + exit $? +fi + +if [ X${USEBZIP} = Xyes ]; then + BZIP=`which bzip2 || echo true` +else + BZIP=true fi # PGBACKUPDIR must be writeable by user pgsql # ~pgsql is just that under normal circumstances, # but this might not be where you want the backups... -PGBACKUPDIR=${HOME}/backups if [ ! -d ${PGBACKUPDIR} ] ; then echo Creating ${PGBACKUPDIR} mkdir ${PGBACKUPDIR} chmod 700 ${PGBACKUPDIR} fi -PGLOGDIR=/var/log/pgsql -PGDIR=`cd ${PGDATA}/../ && pwd` - -GZIP=/usr/bin/bzip2 -GZIPEXT=bz2 - echo -echo "PostgreSQL maintenance..." +echo "PostgreSQL maintenance" # Protect the data umask 077 - -dbname=`${PGBINDIR}/psql -q -t -A -d template1 -c "SELECT datname FROM pg_database WHERE datname != 'template0'"` - -rc=0 - -echo -n "ALL" -PGERRALL=/tmp/PGERRALL.$$ - -${PGBINDIR}/pg_dumpall 2> $PGERRALL | ${GZIP} > ${PGBACKUPDIR}/pgdumpall_`date "+%Y%m%d"`.${GZIPEXT} - -for i in ${dbname}; do - echo -n " $i" - ${PGBINDIR}/pg_dump $i 2>> $PGERRALL | ${GZIP} > ${PGBACKUPDIR}/pgdump_${i}_`date "+%Y%m%d"`.${GZIPEXT} - ${PGBINDIR}/vacuumdb --quiet --analyze $i || rc=3 +dbnames=`psql -q -t -A -d template1 -c "SELECT datname FROM pg_database WHERE datname != 'template0'"` +rc=$? +for db in ${dbnames}; do + echo -n " $db" + file=${PGBACKUPDIR}/pgdump_${db}_`date "+%Y%m%d"` + pg_dump ${PGDUMP_ARGS} -d $db -f ${file} + [ $? -gt 0 ] && rc=3 + ${BZIP} ${file} done -if [ -s "${PGERRALL}" ] -then - echo - echo 'Something went wrong!' +if [ $rc -gt 0 ]; then echo - echo `cat ${PGERRALL}` - rc=3 + echo "Errors were reported during backup." fi -rm ${PGERRALL} echo +echo "vacuuming..." +vacuumdb -a -z -q +if [ $? -gt 0 ] +then + echo + echo "Errors were reported vacuum." + rc=3 +fi +# cleaning up old data find ${PGBACKUPDIR} \( -name 'pgdump_*'.${GZIPEXT} -o -name 'pgdumpall_*'.${GZIPEXT} \) \ -a -atime +7 -delete + exit $rc diff --git a/databases/postgresql91-server/files/dot.cshrc.in b/databases/postgresql91-server/files/dot.cshrc.in index a326041bff7b..724212c70b23 100644 --- a/databases/postgresql91-server/files/dot.cshrc.in +++ b/databases/postgresql91-server/files/dot.cshrc.in @@ -1,6 +1,6 @@ -set path = ( %%PREFIX%%/%%PG_PREFIX%%bin $path ) +set path = ( %%PREFIX%%/bin $path ) -setenv PGLIB %%PREFIX%%/%%PG_PREFIX%%lib +setenv PGLIB %%PREFIX%%/lib # note: PGDATA can be overridden by the -D startup option setenv PGDATA $HOME/data diff --git a/databases/postgresql91-server/files/dot.profile.in b/databases/postgresql91-server/files/dot.profile.in index 4aca6aadd19a..96344d533921 100644 --- a/databases/postgresql91-server/files/dot.profile.in +++ b/databases/postgresql91-server/files/dot.profile.in @@ -1,7 +1,7 @@ # both new and old layout's paths, but new path first... -PATH=%%PREFIX%%/%%PG_PREFIX%%bin:${PATH} +PATH=%%PREFIX%%/bin:${PATH} -PGLIB=%%PREFIX%%/%%PG_PREFIX%%lib +PGLIB=%%PREFIX%%/lib # note: PGDATA can be overridden by the -D startup option PGDATA=${HOME}/data diff --git a/databases/postgresql91-server/files/patch-src::backend::utils::init::findbe.c b/databases/postgresql91-server/files/patch-src::backend::utils::init::findbe.c deleted file mode 100644 index e453be9d93da..000000000000 --- a/databases/postgresql91-server/files/patch-src::backend::utils::init::findbe.c +++ /dev/null @@ -1,13 +0,0 @@ ---- src/backend/utils/init/findbe.c.orig Tue Feb 19 16:03:38 2002 -+++ src/backend/utils/init/findbe.c Tue Feb 19 16:03:45 2002 -@@ -13,9 +13,9 @@ - */ - #include "postgres.h" - -+#include <sys/types.h> - #include <grp.h> - #include <pwd.h> --#include <sys/types.h> - #include <sys/stat.h> - #include <unistd.h> - diff --git a/databases/postgresql91-server/files/pgsql.sh.tmpl b/databases/postgresql91-server/files/pgsql.sh.tmpl index cd78771219ed..d67d9b642f1b 100644 --- a/databases/postgresql91-server/files/pgsql.sh.tmpl +++ b/databases/postgresql91-server/files/pgsql.sh.tmpl @@ -4,28 +4,32 @@ # # For postmaster startup options, edit $PGDATA/postgresql.conf -PGBIN=%%PREFIX%%/%%PG_PREFIX%%bin +PREFIX=%%PREFIX%% +PGBIN=${PREFIX}/bin case $1 in start) - [ -d %%PREFIX%%/%%PG_PREFIX%%lib ] && /sbin/ldconfig -m %%PREFIX%%/%%PG_PREFIX%%lib + [ -d ${PREFIX}/lib ] && /sbin/ldconfig -m ${PREFIX}/lib + touch /var/log/pgsql + chmod 600 /var/log/pgsql + chown pgsql:pgsql /var/log/pgsql [ -x ${PGBIN}/pg_ctl ] && { su -l pgsql -c \ - '[ -d ${PGDATA} ] && exec %%PREFIX%%/%%PG_PREFIX%%bin/pg_ctl start -s -w -l ~pgsql/errlog' + '[ -d ${PGDATA} ] && exec %%PREFIX%%/bin/pg_ctl start -s -w -l /var/log/pgsql' echo -n ' pgsql' } ;; stop) [ -x ${PGBIN}/pg_ctl ] && { - su -l pgsql -c 'exec %%PREFIX%%/%%PG_PREFIX%%bin/pg_ctl stop -s -m fast' + su -l pgsql -c 'exec %%PREFIX%%/bin/pg_ctl stop -s -m fast' echo -n ' pgsql' } ;; status) [ -x ${PGBIN}/pg_ctl ] && { - exec su -l pgsql -c 'exec %%PREFIX%%/%%PG_PREFIX%%bin/pg_ctl status' + exec su -l pgsql -c 'exec %%PREFIX%%/bin/pg_ctl status' } ;; diff --git a/databases/postgresql91-server/files/post-install-notes b/databases/postgresql91-server/files/post-install-notes index 5480550a1ed4..55816362579b 100644 --- a/databases/postgresql91-server/files/post-install-notes +++ b/databases/postgresql91-server/files/post-install-notes @@ -24,12 +24,17 @@ postgresql-plperl, postgresql-pltcl & postgresql-plruby etc etc... +Note that many files have moved around compared to previous versions +of PostgreSQL. For example, plpgsql.so and all other language modules +are now in /usr/local/lib/postgresql. + If you have many tables and many clients running, consider raising -kern.maxfiles using sysctl(8). +kern.maxfiles using sysctl(8), or reconfigure your kernel +appropriately. You should vacuum and backup your database regularly. There is a periodic script, /usr/local/share/postgresql/502.pgsql, that you may -use. +find useful. To allow many simultaneous connections to your PostgreSQL server, you should raise the SystemV shared memory limits in your kernel. Here are |