postgresql start-script

shi hd 78dd085bdacf at gmail.com
Thu Jan 13 07:17:06 PST 2011


I don't know if there is someone already did that, I constructed myself.  It does work though it is a little bit primitive and rudimentary. Any modifications and improvements are welcomed.#! /bin/sh# $PostgreSQL boot time startup script for DragonflyBSD.  Copy this file to
# /usr/pkg/etc/rc.d/postgresql and link to /etc/rc.d/postgresql. v 0.9# 2011/01/08 00:40:00 Shi Exp $. /etc/rc.subrname="pgsql"command="/usr/pkg/bin/pg_ctl"start_cmd="pg_start"
stop_cmd="pg_stop"restart_cmd="pg_restart"status_cmd="pg_status"pg_user="pgsql"datadir="/home/database"logfile="/home/database/log"pg_start()
{    echo -n 'Starting POSTGRESQL'    su -fm ${pg_user} -c "${command} -D ${datadir} -l ${logfile} start -w" &}pg_stop(){    echo -n 'Stopping POSTGRESQL'    su -fm ${pg_user} -c "${command} -D ${datadir} stop -s -m fast -w"
}pg_restart(){    echo -n 'Restarting POSTGRESQL'    su -fm ${pg_user} -c "${command} -D ${datadir} stop -s -m fast -w"    su -fm ${pg_user} -c "${command} -D ${datadir} -l ${logfile} start -w" &
}pg_status(){    echo -n 'Show STATUS'    su -fm ${pg_user} -c "${command} -D ${datadir} status"}load_rc_config $namerun_rc_command "$1"---------------------------------
                             hd




More information about the Users mailing list