aboutsummaryrefslogtreecommitdiff
path: root/net/balance/files
diff options
context:
space:
mode:
authorOliver Eikemeier <eik@FreeBSD.org>2003-11-22 20:49:09 +0000
committerOliver Eikemeier <eik@FreeBSD.org>2003-11-22 20:49:09 +0000
commitad07707ba0bd21be8e810a0ee60d97adde81fa2c (patch)
tree09f9d5286b9826073f8f32e268dffc8b5caa14d6 /net/balance/files
parentdebac8b3272f21a20ef76f44853598044fa90c4c (diff)
downloadports-ad07707ba0bd21be8e810a0ee60d97adde81fa2c.tar.gz
ports-ad07707ba0bd21be8e810a0ee60d97adde81fa2c.zip
Notes
Diffstat (limited to 'net/balance/files')
-rw-r--r--net/balance/files/balance.sh79
1 files changed, 79 insertions, 0 deletions
diff --git a/net/balance/files/balance.sh b/net/balance/files/balance.sh
new file mode 100644
index 000000000000..bfffe90a3b31
--- /dev/null
+++ b/net/balance/files/balance.sh
@@ -0,0 +1,79 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: balance
+# REQUIRE: LOGIN
+# KEYWORD: FreeBSD shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable balance:
+#
+#balance_enable="YES"
+#balance_hosts="host1"
+#balance_host1_adress="host1.external.example"
+#balance_host1_ports="http 8180"
+#balance_host1_targets="host1.internal.example"
+#
+# See balance(8) for flags
+#
+
+. %%RC_SUBR%%
+
+name=balance
+rcvar=`set_rcvar`
+command=%%PREFIX%%/bin/balance
+
+start_cmd=start_cmd
+stop_cmd=stop_cmd
+status_cmd=status_cmd
+
+start_cmd()
+{
+ if [ -x "${command}" ]; then
+ for host in ${balance_hosts}; do
+ eval ports=\"\${balance_${host}_ports}\"
+ eval adress=\"\${balance_${host}_adress}\"
+ eval targets=\"\${balance_${host}_targets}\"
+ for port in ${ports}; do
+ "${command}" -b ${adress} ${port} ${targets}
+ done
+ done
+ fi
+}
+
+stop_cmd()
+{
+ if [ -x "${command}" ]; then
+ for host in ${balance_hosts}; do
+ eval ports=\"\${balance_${host}_ports}\"
+ eval adress=\"\${balance_${host}_adress}\"
+ for port in ${ports}; do
+ echo "balance at ${adress}:${port}"
+ "${command}" -b ${adress} -c kill ${port}
+ done
+ done
+ fi
+}
+
+status_cmd()
+{
+ if [ -x "${command}" ]; then
+ for host in ${balance_hosts}; do
+ eval ports=\"\${balance_${host}_ports}\"
+ eval adress=\"\${balance_${host}_adress}\"
+ for port in ${ports}; do
+ echo "balance at ${adress}:${port}"
+ "${command}" -b ${adress} -c show ${port}
+ done
+ done
+ fi
+}
+
+# set defaults
+
+balance_enable=${balance_enable:-"NO"}
+
+load_rc_config $name
+run_rc_command "$1"