--- /dev/null
+#!/usr/bin/env bash
+
+# run command as ./refresh_service_status.sh http://gjb-www-3.cluster.lifesci.dundee.ac.uk:9507/jabaws/ServiceStatus 15 cached_service_status.html &
+# the command starts executing, but continues to run forever
+
+# Host URL $1 (example: http://gjb-www-3.cluster.lifesci.dundee.ac.uk:9507/jabaws/ServiceStatus)
+# Host URL $1 (example: http://gjb-www-3.cluster.lifesci.dundee.ac.uk:9507/jabaws/PublicAnnualStat)
+if [ -z "$1" ]
+ then
+ echo "Hostname needs to be passed as 1st argument! (example http://compbio.lifesci.dundee.ac.uk/jabaws/ServiceStatus)"
+ exit 1
+fi
+
+# Refresh Time $2 (minutes)
+if [ -z "$2" ]
+ then
+ echo "Refresh Time (min) needs to be passed as 2nd argument! (example 15)"
+ exit 1
+fi
+
+# Output-file $3 (html) (example: cached_service_status.html)
+# Output-file $3 (html) (example: cached_usage_statistics.html)
+if [ -z "$3" ]
+ then
+ echo "Outputfile (html) needs to be passed as 3rd argument! (example: cached_service_status.html)"
+ exit 1
+fi
+
+# gets the file as a tmp
+while :; do echo "Fetching from $1:" `date "+%d/%m/%Y %H:%M:%S"`; wget -q $1 -O "tmp_cache.html"; mv "tmp_cache.html" $3; sleep $2m; done
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="dt" %>
-<c:import url="/template_header.jsp" >
- <c:param name="title">Service Status</c:param>
- <c:param name="html_custom_css"><link href="${pageContext.request.contextPath}/static/css/table.css"
- rel="stylesheet"></c:param>
-</c:import>
-
-<%-- check if the cached page is available: if not redirects--%>
-<%@ page import="java.io.*,java.net.*" %>
-<%
- URL url = new URL(request.getRequestURL().toString().replaceAll("/service_status.jsp", "") +
- "/cached_service_status.html");
- HttpURLConnection http = (HttpURLConnection)url.openConnection();
- int statusCode = http.getResponseCode();
- if (statusCode != 200) {
- String redirectURL = "ServiceStatus";
- response.sendRedirect(redirectURL);}
-%>
-
-<%-- load cached Service Status --%>
- <div class="row">
- <div class="col-md-3"></div>
- <div class="col-md-6">
- <div class="center-block">
- <hidden_loader style="display:none;">
- <div class="alert alert-warning" role="alert">
- <p style="text-align: center; font-size: 16px">
- <img src="${pageContext.request.contextPath}/static/img/loader.gif" style="width:7%;height:7%">
- This request usually takes several minutes to be served...
- </p>
- </div>
- </hidden_loader>
- </div>
- </div>
- <div class="col-md-3"></div>
- </div>
-
-<div class="row" id="mainpage">
- <div class="col-md-12">
- <p>The results shown below have been cached from a request made (up to an hour) before...
- <a class="btn btn-default" href="${pageContext.request.contextPath}/ServiceStatus" role="button"
- title="JABAWS web-services status."
- id="show_hidden1"><i class="fa fa-cogs" aria-hidden="true"></i> Get fresh Service Status</a>
- </p>
- </div>
-</div>
+<%@ page errorPage="ServiceStatus" %>
<jsp:include page="/cached_service_status.html" />
-
-<jsp:include page="/template_footer.jsp" />
rel="stylesheet"></c:param>
</c:import>
+<%-- load cached Service Status --%>
+ <div class="row">
+ <div class="col-md-3"></div>
+ <div class="col-md-6">
+ <div class="center-block">
+ <hidden_loader style="display:none;">
+ <div class="alert alert-warning" role="alert">
+ <p style="text-align: center; font-size: 16px">
+ <img src="${pageContext.request.contextPath}/static/img/loader.gif" style="width:7%;height:7%">
+ This request usually takes several minutes to be served...
+ </p>
+ </div>
+ </hidden_loader>
+ </div>
+ </div>
+ <div class="col-md-3"></div>
+ </div>
+
<div class="row" id="mainpage">
<div class="col-md-12">
<div class="panel panel-default">
rel="stylesheet"></c:param>
</c:import>
+<%-- load cached Service Status --%>
+ <div class="row">
+ <div class="col-md-3"></div>
+ <div class="col-md-6">
+ <div class="center-block">
+ <hidden_loader style="display:none;">
+ <div class="alert alert-warning" role="alert">
+ <p style="text-align: center; font-size: 16px">
+ <img src="${pageContext.request.contextPath}/static/img/loader.gif" style="width:7%;height:7%">
+ This request usually takes several minutes to be served...
+ </p>
+ </div>
+ </hidden_loader>
+ </div>
+ </div>
+ <div class="col-md-3"></div>
+ </div>
+
<div class="row" id="mainpage">
<div class="col-md-12">
<div class="panel panel-default">
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="dt" %>
-<c:import url="/template_header.jsp" >
- <c:param name="title">Usage Statistics</c:param>
- <c:param name="html_custom_css"><link href="${pageContext.request.contextPath}/static/css/table.css"
- rel="stylesheet"></c:param>
-</c:import>
-
-<%-- check if the cached page is available: if not redirects--%>
-<%@ page import="java.io.*,java.net.*" %>
-<%
- URL url = new URL(request.getRequestURL().toString().replaceAll("/usage_statistics.jsp", "") +
- "/cached_usage_statistics.html");
- HttpURLConnection http = (HttpURLConnection)url.openConnection();
- int statusCode = http.getResponseCode();
- if (statusCode != 200) {
- String redirectURL = "PublicAnnualStat";
- response.sendRedirect(redirectURL);}
-%>
-
-<%-- load cached Service Status --%>
- <div class="row">
- <div class="col-md-3"></div>
- <div class="col-md-6">
- <div class="center-block">
- <hidden_loader style="display:none;">
- <div class="alert alert-warning" role="alert">
- <p style="text-align: center; font-size: 16px">
- <img src="${pageContext.request.contextPath}/static/img/loader.gif" style="width:7%;height:7%">
- This request usually takes several minutes to be served...
- </p>
- </div>
- </hidden_loader>
- </div>
- </div>
- <div class="col-md-3"></div>
- </div>
-
-<div class="row" id="mainpage">
- <div class="col-md-12">
- <p>The results shown below have been cached from a request made (up to an hour) before...
- <a class="btn btn-default" href="${pageContext.request.contextPath}/PublicAnnualStat" role="button"
- title="JABAWS server usage statistics."
- id="show_hidden2"><i class="fa fa-bar-chart" aria-hidden="true"></i> Get fresh Usage Statistics</a>
- </p>
- </div>
-</div>
+<%@ page errorPage="PublicAnnualStat" %>
<jsp:include page="/cached_usage_statistics.html" />
-
-<jsp:include page="/template_footer.jsp" />