freebsd-ports/databases/pgcluster/files/pgcluster.in
Rong-En Fan 6c27ac50f1 - Change the way how we assign default value
- Some style changes to match Porter's Handbook

Suggested by:	dougb
2007-07-26 16:05:04 +00:00

58 lines
1.2 KiB
Bash

#!/bin/sh
#
# $FreeBSD: /tmp/pcvs/ports/databases/pgcluster/files/Attic/pgcluster.in,v 1.2 2007-07-26 16:05:04 rafan Exp $
#
# PROVIDE: pgcluster
# REQUIRE: DAEMON
# BEFORE: pgreplicate
#
# Add the following line to /etc/rc.conf to enable pgcluster:
#
# pgcluster_enable="YES"
# # optional
# pgcluster_data="/home/pgsql/data"
# pgcluster_flags="-w -s"
#
. %%RC_SUBR%%
name="pgcluster"
rcvar=`set_rcvar`
command=%%PREFIX%%/bin/pg_ctl
load_rc_config ${name}
: ${pgcluster_enable="NO"}
: ${pgcluster_data="%%PREFIX%%/pgsql/data"}
: ${pgcluster_flags="-w -s"}
pgcluster_user=pgsql
pgcluster_flags="${pgcluster_flags} -D ${pgcluster_data}"
pidfile="${pgcluster_data}/postmaster.pid"
extra_commands="initdb recover"
initdb_cmd="pgcluster_initdb"
recover_cmd="pgcluster_recover"
start_cmd="pgcluster_start"
stop_cmd="pgcluster_stop"
pgcluster_start()
{
su -m ${pgcluster_user} -c "exec ${command} start ${pgcluster_flags} -o '-i'"
}
pgcluster_stop()
{
su -m ${pgcluster_user} -c "exec ${command} stop ${pgcluster_flags} -m i"
}
pgcluster_recover()
{
su -m ${pgcluster_user} -c "exec ${command} start ${pgcluster_flags} -o '-i -R'"
}
pgcluster_initdb()
{
su -m ${pgcluster_user} -c "exec %%PREFIX%%/bin/initdb -D ${pgcluster_data}"
}
run_rc_command "$1"