X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0FC1E53224 for ; Mon, 18 Apr 2005 18:56:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 05269-01 for ; Mon, 18 Apr 2005 21:55:58 +0000 (GMT) Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id D366C53321 for ; Mon, 18 Apr 2005 18:55:56 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id j3ILtv724789; Mon, 18 Apr 2005 17:55:57 -0400 (EDT) From: Bruce Momjian Message-Id: <200504182155.j3ILtv724789@candle.pha.pa.us> Subject: Re: Latest pg_autovacuum script In-Reply-To: To: Theo Galanakis Date: Mon, 18 Apr 2005 17:55:57 -0400 (EDT) Cc: pgsql-admin@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.01 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/248 X-Sequence-Number: 17261 Do you want this in CVS for 8.0.X? --------------------------------------------------------------------------- Theo Galanakis wrote: > > Hi, > I have updated the pg_autovacuum script with some bug fixes and > changes. Hope you find this useful. > > -- This goes where all the other init scripts are located. > -- Can be placed at the top of /etc/rc.d/init.d/postgresql script or in the > /etc/sysconfig/pgsql/{name of script} e.g. postgresql, pg1, pg2 > # Initialize pg_autovacuum defaults. Theo Galanakis 11/04/2005 > PGAUTO_LOGFILE=/var/log/pg_autovacuum.{$PGPORT}.log > PGAUTO_SLEEP=600 > > --Include at the top of /etc/rc.d/init.d/postgresql > # pg_autovaccum Include script file. Theo Galanakis 11/04/2005 > . $INITD/autovacuum > > > --Update case statement in postgresql script > case "$1" in > start) > start > startautovacuum > ;; > stop) > stop > stopautovacuum > ;; > status) > status postmaster > statusautovacuum > ;; > restart) > restart > restartautovacuum > ;; > > > --Create a new file /etc/rc.d/init.d/autovacuum with this content. > startautovacuum() { > # Start pg_autovacuum. Theo Galanakis 11/05/2005 > # Note : ensure $PGENGINE is being used in script otherwise hardcode > to /usr/bin/ > if [ -f /var/run/pg_autovacuum.${PGPORT}.pid ] > then > echo $"pg_autovacuum already running." > else > PAUTO_START=$"Starting pg_autovacuum service: " > echo -n "$PAUTO_START" > pg_autovacuum -D -s ${PGAUTO_SLEEP} -p ${PGPORT} -U postgres > -L ${PGAUTO_LOGFILE} > sleep 1 > pg_autovacuum_pid=`pidof -s $PGENGINE/pg_autovacuum` > if [ $pg_autovacuum_pid ] > then > success "$PAUTO_START" > echo $pg_autovacuum_pid > > /var/run/pg_autovacuum.${PGPORT}.pid > echo > else > failure "$PAUTO_START" > echo > fi > fi > } > > stopautovacuum () { > # Stop pg_autovaccum. Theo Galanakis 11/04/2005 > if [ -f /var/run/pg_autovacuum.${PGPORT}.pid ] > then > pg_autovacuum_pid=`head -n 1 > /var/run/pg_autovacuum.${PGPORT}.pid` > ret=`ps --no-heading ${pg_autovacuum_pid}` > if [ -z "$ret" ] > then > echo $"pg_autovacuum: pid [${pg_autovacuum_pid}] > stored in /var/run/pg_autovacuum.${PGPORT}.pid does not exist." > else > echo -n $"Stopping pg_autovacuum service: " > > kill -TERM $pg_autovacuum_pid > ret=`ps --no-heading ${pg_autovacuum_pid}` > if [ -z "$ret" ] > then > echo_success > else > echo_failure > fi > echo > rm -f /var/run/pg_autovacuum.${PGPORT}.pid > fi > else > echo $"pg_autovacuum is not running." > fi > } > > statusautovacuum() { > # Status pg_autovacuum. Theo Galanakis 11/04/2005 > if [ -f /var/run/pg_autovacuum.${PGPORT}.pid ] > then > pg_autovacuum_pid=`head -n 1 > /var/run/pg_autovacuum.${PGPORT}.pid` > ret=`ps --no-heading ${pg_autovacuum_pid}` > if [ -z "$ret" ] > then > echo $"pg_autovacuum not running..." > else > echo $"pg_autovacuum (pid ${pg_autovacuum_pid}) is > running..." > fi > else > status pg_autovacuum > fi > } > > restartautovacuum() { > stopautovacuum > startautovacuum > } > > > > ______________________________________________________________________ > This email, including attachments, is intended only for the addressee > and may be confidential, privileged and subject to copyright. If you > have received this email in error, please advise the sender and delete > it. If you are not the intended recipient of this email, you must not > use, copy or disclose its content to anyone. You must not copy or > communicate to others content that is confidential or subject to > copyright, unless you have the consent of the content owner. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073