pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedLatest pg_autovacuum script
2+ messages / 2 participants
[nested] [flat]
* Latest pg_autovacuum script
@ 2005-04-15 02:14 Theo Galanakis <Theo.Galanakis@lonelyplanet.com.au>
0 siblings, 1 reply; 2+ messages in thread
From: Theo Galanakis @ 2005-04-15 02:14 UTC (permalink / raw)
To: pgsql-admin
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.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Latest pg_autovacuum script
@ 2005-04-18 21:55 Bruce Momjian <pgman@candle.pha.pa.us>
parent: Theo Galanakis <Theo.Galanakis@lonelyplanet.com.au>
0 siblings, 0 replies; 2+ messages in thread
From: Bruce Momjian @ 2005-04-18 21:55 UTC (permalink / raw)
To: Theo Galanakis <Theo.Galanakis@lonelyplanet.com.au>; +Cc: pgsql-admin
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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-04-18 21:55 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-04-15 02:14 Latest pg_autovacuum script Theo Galanakis <Theo.Galanakis@lonelyplanet.com.au>
2005-04-18 21:55 ` Bruce Momjian <pgman@candle.pha.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox