From: | "Markus Wollny" <Markus(dot)Wollny(at)computec(dot)de> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Cron-job for checking up on pg_autovacuum |
Date: | 2003-11-25 02:13:01 |
Message-ID: | 2266D0630E43BB4290742247C891057502B9D368@dozer.computec.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi!
I haven't found anything in terms of startup- and check-scripts for
pg_autovacuum yet; usually I like to have some sort of mechanism to
check if some daemon is running and restart it if it isn't.
Of course this sort of script shouldn't be too much of a bother for more
experienced users; however you might actually find this small
checkup-script more or less useful - just save it in /opt/pgsql/bin/ as
autovachk, chmod +x and follow the included instructions for adding it
to your crontab.
Regards
Markus
#!/bin/sh
#
# This is a script suitable for use in a crontab. It checks to make
sure
# your pg_autovacuum daemon is running.
#
# To check for the daemon every 5 minutes, put the following line in
your
# crontab:
# 2,7,12,17,22,27,32,37,42,47,52,57 * * * *
# /opt/pgsql/bin/autovachk >/dev/null 2>&1
# change this to the directory you run the daemon from:
dir="/opt/pgsql/bin"
# change this to the complete commandline you usually start the daemon
with
daemoninvoc="pg_autovacuum -D -U postgres -L /var/log/pgautovac.log"
# I wouldn't touch this if I were you.
daemonpid=`eval ps ax | sed -n '/[p]g_autovacuum/p' | awk '{ print $1
}'`
########## you probably don't need to change anything below here
##########
cd $dir
if `kill -CHLD $daemonpid >/dev/null 2>&1`; then
# it's still going, so back out quietly
exit 0
fi
echo ""
echo "Couldn't find the pg_autovacuum daemon running. Reloading it..."
echo ""
./$daemoninvoc
sleep 3
From | Date | Subject | |
---|---|---|---|
Next Message | Christopher Browne | 2003-11-25 02:58:05 | Re: Where is Postgesql ? - MYSQL SURPRISES WITH MAXDB / |
Previous Message | Bruce Momjian | 2003-11-25 01:58:49 | Re: Humor me: Postgresql vs. MySql (esp. licensing) |