diff options
author | demon <demon@FreeBSD.org> | 2015-03-13 00:08:18 +0800 |
---|---|---|
committer | demon <demon@FreeBSD.org> | 2015-03-13 00:08:18 +0800 |
commit | a9a49ad5c124b70a95f25b28b5e145e17f07d100 (patch) | |
tree | b65e525a54bf350c6cdaacdafadc4b8b8185db1b /net/haproxy | |
parent | 10d06c68777fb788f8444233f51b82984a520c22 (diff) | |
download | freebsd-ports-gnome-a9a49ad5c124b70a95f25b28b5e145e17f07d100.tar.gz freebsd-ports-gnome-a9a49ad5c124b70a95f25b28b5e145e17f07d100.tar.zst freebsd-ports-gnome-a9a49ad5c124b70a95f25b28b5e145e17f07d100.zip |
Ouch, I deleted the wrong file :(
Diffstat (limited to 'net/haproxy')
-rw-r--r-- | net/haproxy/files/haproxy.in | 117 | ||||
-rw-r--r-- | net/haproxy/files/pkg-message.in | 12 |
2 files changed, 117 insertions, 12 deletions
diff --git a/net/haproxy/files/haproxy.in b/net/haproxy/files/haproxy.in new file mode 100644 index 000000000000..751b3067d083 --- /dev/null +++ b/net/haproxy/files/haproxy.in @@ -0,0 +1,117 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: haproxy +# REQUIRE: DAEMON LOGIN +# KEYWORD: shutdown + +# +# Add the following lines to /etc/rc.conf to enable haproxy: +# +# haproxy_enable (bool): default: "NO" +# Set to "YES" to enable haproxy +# haproxy_pidfile (str): default: /var/run/haproxy.pid +# Set to the full path of the pid file +# haproxy_config (str): default: %%PREFIX%%/etc/haproxy.conf +# Set to the full path of the config file +# haproxy_flags (str): default: Autogenerated using pidfile and config options +# Set to override with your own options +# haproxy_profiles (str): default: empty +# Set to space-separated list of profiles: for each profile separate haproxy +# process will be spawned, with haproxy-${profile}.conf config file. +# You can override default pidfile and config file for each profile with +# haproxy_${profile}_config and haproxy_${profile}_pidfile. + +. /etc/rc.subr + +name="haproxy" +rcvar=haproxy_enable +command="%%PREFIX%%/sbin/haproxy" +extra_commands="reload configtest" +reload_cmd="haproxy_reload" +stop_cmd="haproxy_stop" + +: ${haproxy_enable:="NO"} +: ${haproxy_config:="%%PREFIX%%/etc/${name}.conf"} +pidfile=${haproxy_pidfile:-"/var/run/haproxy.pid"} + +if [ -z "$rc_force" ]; then + sig_stop="USR1" +fi + +load_rc_config $name + +is_valid_profile() { + local profile + for profile in $haproxy_profiles; do + if [ "$profile" = "$1" ]; then + return 0 + fi + done + return 1 +} + +if [ -n "$2" ]; then + profile=$2 + if ! is_valid_profile $profile; then + echo "$0: no such profile ($profile) defined in ${name}_profiles." + exit 1 + fi + eval haproxy_config="\${haproxy_${profile}_config:-%%PREFIX%%/etc/haproxy-${profile}.conf}" + eval pidfile="\${haproxy_${profile}_pidfile:-/var/run/haproxy-${profile}.pid}" +else + if [ "x${haproxy_profiles}" != "x" -a "x$1" != "x" ]; then + for profile in ${haproxy_profiles}; do + echo "===> ${name} profile: ${profile}" + %%PREFIX%%/etc/rc.d/haproxy $1 ${profile} + retcode="$?" + if [ ${retcode} -ne 0 ]; then + failed="${profile} (${retcode}) ${failed:-}" + else + success="${profile} ${success:-}" + fi + done + exit 0 + fi +fi + +: ${haproxy_flags:="-q -f ${haproxy_config} -p ${pidfile}"} +configtest_cmd="$command -c -f $haproxy_config" +start_precmd="$command -q -c -f $haproxy_config" +required_files=$haproxy_config + +haproxy_reload() +{ + ${command} -q -c -f ${haproxy_config} + if [ $? -ne 0 ]; then + err 1 "Error found in ${haproxy_config} - not reloading current process!" + fi + rc_pid=$(check_pidfile ${pidfile} ${command}) + if [ $rc_pid ]; then + if [ -z "$rc_force" ]; then + ${command} ${haproxy_flags} -sf $(cat ${pidfile}) + else + ${command} ${haproxy_flags} -st $(cat ${pidfile}) + fi + else + _run_rc_notrunning + return 1 + fi +} + +haproxy_stop() +{ + rc_pid=$(check_pidfile ${pidfile} ${command}) + if [ $rc_pid ]; then + rc_pid=$(cat ${pidfile}) + kill -$sig_stop $rc_pid + wait_for_pids $rc_pid + else + _run_rc_notrunning + return 1 + fi +} + +run_rc_command "$1" diff --git a/net/haproxy/files/pkg-message.in b/net/haproxy/files/pkg-message.in deleted file mode 100644 index f82088041d20..000000000000 --- a/net/haproxy/files/pkg-message.in +++ /dev/null @@ -1,12 +0,0 @@ - -************************************************* -* Congratulations! Haproxy is now installed. * -************************************************* - -Check the following directories for further info: - documentation: '%%DOCSDIR%%' - examples: '%%EXAMPLESDIR%%' - -rc.conf variables listing can be found in: - '%%PREFIX%%/etc/rc.d/haproxy' - |