From 5639de7571bc1807e6486c9d05cc455a74346922 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 22 Apr 2014 15:17:41 +0000 Subject: Add a "WHEN" variant of "GIVEN a running WEBAPP" --- yarns.webapp/yarn.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'yarns.webapp/yarn.sh') diff --git a/yarns.webapp/yarn.sh b/yarns.webapp/yarn.sh index 3c617e3..6f93a5f 100644 --- a/yarns.webapp/yarn.sh +++ b/yarns.webapp/yarn.sh @@ -54,3 +54,45 @@ stdin_is_empty() exit 1 fi } + + +# Configure (unless already configured) and start a WEBAPP. + +start_webapp() +{ + rm -f "$DATADIR/webapp.pid" + rm -f "$DATADIR/webapp.port" + mkfifo "$DATADIR/webapp.port" + + add_to_config_file "$DATADIR/webapp.conf" \ + statedb "$DATADIR/webapp.db" + add_to_config_file "$DATADIR/webapp.conf" \ + status-html "$DATADIR/lc-status.html" + add_to_config_file "$DATADIR/webapp.conf" \ + log "$DATADIR/webapp.log" + add_to_config_file "$DATADIR/webapp.conf" \ + log-level debug + add_to_config_file "$DATADIR/webapp.conf" \ + debug-host 127.0.0.1 + add_to_config_file "$DATADIR/webapp.conf" \ + debug-port-file "$DATADIR/webapp.port" + add_to_config_file "$DATADIR/webapp.conf" \ + static-files "$SRCDIR/static" + add_to_config_file "$DATADIR/webapp.conf" \ + templates "$SRCDIR/templates" + add_to_config_file "$DATADIR/webapp.conf" \ + debug-real-confgit no + + start-stop-daemon -S -x "$SRCDIR/lorry-controller-webapp" \ + -b -p "$DATADIR/webapp.pid" -m --verbose \ + -- \ + --config "$DATADIR/webapp.conf" + + port=$(cat "$DATADIR/webapp.port") + rm -f "$DATADIR/webapp.port" + echo "$port" >"$DATADIR/webapp.port" + + # Wait for the WEBAPP to actually be ready, i.e., that it's + # listening on its assigned port. + "$SRCDIR/test-wait-for-port" 127.0.0.1 "$port" +} -- cgit v1.2.1