mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-04 02:30:45 +00:00
Merge pull request #169 from tomwilkie/153
Allow users to specify app and probe arguments.
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
usage() {
|
||||
echo "$0 --dns <IP> --hostname <NAME> --searchpath <SEARCHPATH>"
|
||||
echo "$0 --dns <IP> --hostname <NAME> --searchpath <SEARCHPATH> --app.foo bar --probe.foo bar"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# This script exists to modify the network settings in the scope containers
|
||||
# as docker doesn't allow it when started with --net=host
|
||||
|
||||
APP_ARGS=""
|
||||
PROBE_ARGS=""
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
--dns)
|
||||
@@ -19,12 +23,30 @@ while true; do
|
||||
SEARCHPATH="$2"
|
||||
shift 2
|
||||
;;
|
||||
--app.*)
|
||||
[ $# -gt 1 ] || usage
|
||||
ARG_NAME=$(echo "$1" | sed 's/\-\-app\.//')
|
||||
ARG_VALUE="$2"
|
||||
shift 2
|
||||
APP_ARGS="$APP_ARGS -$ARG_NAME=$ARG_VALUE"
|
||||
;;
|
||||
--probe.*)
|
||||
[ $# -gt 1 ] || usage
|
||||
ARG_NAME=$(echo "$1" | sed 's/\-\-probe\.//')
|
||||
ARG_VALUE="$2"
|
||||
shift 2
|
||||
PROBE_ARGS="$PROBE_ARGS -$ARG_NAME=$ARG_VALUE"
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
mkdir -p /etc/weave
|
||||
echo "$APP_ARGS" >/etc/weave/app.args
|
||||
echo "$PROBE_ARGS" >/etc/weave/probe.args
|
||||
|
||||
if [ -n "$DNS_SERVER" -a -n "$SEARCHPATH" ]; then
|
||||
echo "domain $SEARCHPATH" >/etc/resolv.conf
|
||||
echo "search $SEARCHPATH" >>/etc/resolv.conf
|
||||
@@ -36,7 +58,6 @@ fi
|
||||
# using Weave DNS. We stick these in /etc/weave/probes
|
||||
# for the run-app script to pick up.
|
||||
MANUAL_PROBES=$@
|
||||
mkdir -p /etc/weave
|
||||
echo "$MANUAL_PROBES" >/etc/weave/probes
|
||||
|
||||
exec /sbin/runsvdir /etc/service
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
exec /home/weave/app $(cat /etc/weave/probes)
|
||||
exec /home/weave/app $(cat /etc/weave/app.args) $(cat /etc/weave/probes)
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
exec /home/weave/probe
|
||||
exec /home/weave/probe $(cat /etc/weave/probe.args)
|
||||
|
||||
Reference in New Issue
Block a user