#!/bin/sh

CONFIG=""
LOGFILE=/opt/local/var/log/pgsql/pg_autovacuum.log

PREFIX=/opt/local
PGBIN=${PREFIX}/bin

case $1 in
start)
    [ -x ${PGBIN}/pg_autovacuum ] && {
	[ x${LOGFILE} != x ] && CONFIG="${CONFIG} -L ${LOGFILE}"
	echo -n ' pg_autovacuum'
	su -l pgsql -c "exec ${PREFIX}/bin/pg_autovacuum -D ${CONFIG}"
    }
    ;;

*)
    echo "usage: `basename $0` {start}" >&2
    exit 64
    ;;
esac
