diff options
author | Palle Girgensohn <girgen@FreeBSD.org> | 2016-01-07 19:58:47 +0000 |
---|---|---|
committer | Palle Girgensohn <girgen@FreeBSD.org> | 2016-01-07 19:58:47 +0000 |
commit | 433061043695cb1661743d544689f34e707dd530 (patch) | |
tree | bdb61088be11f66199abd9db3afcc9a38d666f41 /databases/postgresql95-server/files/postgresql.in | |
parent | Quickly fix a stupid typo made in previous commit. (diff) |
The PostgreSQL Global Development Group announces the
release of PostgreSQL 9.5.
This release adds UPSERT capability, Row Level Security,
and multiple Big Data features, which will broaden the
user base for the world's most advanced database.
With these new capabilities, PostgreSQL will be
the best choice for even more applications for startups,
large corporations, and government agencies.
Release Notes:
http://www.postgresql.org/docs/current/static/release-9-5.html
What's New in 9.5:
https://wiki.postgresql.org/wiki/What%27s_new_in_PostgreSQL_9.5
Diffstat (limited to 'databases/postgresql95-server/files/postgresql.in')
-rw-r--r-- | databases/postgresql95-server/files/postgresql.in | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/databases/postgresql95-server/files/postgresql.in b/databases/postgresql95-server/files/postgresql.in new file mode 100644 index 000000000000..643171a44b91 --- /dev/null +++ b/databases/postgresql95-server/files/postgresql.in @@ -0,0 +1,114 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: postgresql +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following line to /etc/rc.conf to enable PostgreSQL: +# +# postgresql_enable="YES" +# # optional +# postgresql_data="%%PREFIX%%/%%PG_USER%%/data" +# postgresql_flags="-w -s -m fast" +# postgresql_initdb_flags="--encoding=utf-8 --lc-collate=C" +# postgresql_class="default" +# postgresql_profiles="" +# +# See %%PREFIX%%/share/doc/postgresql/README-server for more info +# +# This scripts takes one of the following commands: +# +# start stop restart reload status initdb +# +# For postmaster startup options, edit ${postgresql_data}/postgresql.conf + +command=%%PREFIX%%/bin/pg_ctl + +. /etc/rc.subr + +load_rc_config postgresql + +# set defaults +postgresql_enable=${postgresql_enable:-"NO"} +postgresql_flags=${postgresql_flags:-"-w -s -m fast"} +postgresql_user=${postgresql_user:-"%%PG_USER%%"} +eval postgresql_data=${postgresql_data:-"~${postgresql_user}/data"} +postgresql_class=${postgresql_class:-"default"} +postgresql_initdb_flags=${postgresql_initdb_flags:-"--encoding=utf-8 --lc-collate=C"} + +name=postgresql +rcvar=postgresql_enable +extra_commands="reload initdb" + +start_cmd="postgresql_command start" +stop_cmd="postgresql_command stop" +restart_cmd="postgresql_command restart" +reload_cmd="postgresql_command reload" +status_cmd="postgresql_command status" + +initdb_cmd="postgresql_initdb" + +if [ -n "$2" ]; then + profile="$2" + if [ "x${postgresql_profiles}" != "x" ]; then + eval postgresql_data="\${postgresql_${profile}_data:-}" + if [ "x${postgresql_data}" = "x" ]; then + echo "You must define a data directory (postgresql_${profile}_data)" + exit 1 + fi + eval postgresql_enable="\${postgresql_${profile}_enable:-${postgresql_enable}} + eval postgresql_data="\${postgresql_${profile}_data:-${postgresql_data}} + eval postgresql_flags="\${postgresql_${profile}_flags:-${postgresql_flags}}" + eval postgresql_initdb_flags="\${postgresql_${profile}_initdb_flags:-${postgresql_initdb_flags}}" + fi +else + if [ "x${postgresql_profiles}" != "x" -a "x$1" != "x" ]; then + for profile in ${postgresql_profiles}; do + eval _enable="\${postgresql_${profile}_enable}" + case "x${_enable:-${postgresql_enable}}" in + x|x[Nn][Oo]|x[Nn][Oo][Nn][Ee]) + continue + ;; + x[Yy][Ee][Ss]) + ;; + *) + if test -z "$_enable"; then + _var=postgresql_enable + else + _var=postgresql_"${profile}"_enable + fi + echo "Bad value" \ + "'${_enable:-${postgresql_enable}}'" \ + "for ${_var}. " \ + "Profile ${profile} skipped." + continue + ;; + esac + echo "===> postgresql profile: ${profile}" + %%PREFIX%%/etc/rc.d/postgresql $1 ${profile} + retcode="$?" + if [ "0${retcode}" -ne 0 ]; then + failed="${profile} (${retcode}) ${failed:-}" + else + success="${profile} ${success:-}" + fi + done + exit 0 + fi +fi + +command_args="-D ${postgresql_data} ${postgresql_flags}" + +postgresql_command() +{ + su -l ${postgresql_user} -c "exec ${command} ${command_args} ${rc_arg}" +} + +postgresql_initdb() +{ + su -l -c ${postgresql_class} ${postgresql_user} -c "exec %%PREFIX%%/bin/initdb ${postgresql_initdb_flags} -D ${postgresql_data}" +} + +run_rc_command "$1" |