]> git.za3k.com Git - za3k.git/commitdiff
Try to parse time in status.cgi
authorZachary Vance <za3k@za3k.com>
Tue, 20 Jun 2017 21:07:49 +0000 (14:07 -0700)
committerZachary Vance <za3k@za3k.com>
Tue, 20 Jun 2017 21:07:49 +0000 (14:07 -0700)
cgi-bin/status-simple
cgi-bin/status.cgi

index 9b1cc2d05b6f31aca69eaf7ae900e5c20e224fbb..3ac83d6bf1fac739c7cd3239d67a2ef9338a26b3 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/bash
 TEMP=$(mktemp)
-timeout 5 bash "$@" >"$TEMP" 2>/dev/null
+SECONDS=5
+if [ $# -eq 1 ]; then SECONDS="$1"; shift; fi
+timeout "${SECONDS}" bash "$@" >"$TEMP" 2>/dev/null
 SUCCESS=$?
 
 if [ "$SUCCESS" -eq 0 ]; then
index 62b9fed7df190b14e156d983959ddc8660a52759..22c3438f77da7e9dd6b55d8d1859943bfc6f2b5b 100755 (executable)
@@ -4,6 +4,12 @@ echo
 
 STATUS="$(basename "$PATH_TRANSLATED")"
 FOLDER="/var/www/za3k/cgi-bin/${STATUS}.d"
+SECONDS=5
+if [[ "${QUERY_STRING}" =~ ^t=[0-9]+$ ]]
+then
+    SECONDS="${QUERY_STRING#t=}"
+fi
+export SECONDS
 
 echo "<html>"
 echo "<head>"
@@ -17,7 +23,7 @@ echo "    <th>Service</td>"
 echo "    <th>Status</td>"
 echo "    <th>Details</td>"
 echo "  </thead>"
-find "${FOLDER}" -type f -print0 | sort -z | SHELL=/bin/sh parallel -0 -j 0 --keep-order -n1 -- ./status-simple
+find "${FOLDER}" -type f -print0 | sort -z | SHELL=/bin/sh parallel -0 -j 0 --keep-order -n1 -- ./status-simple "${SECONDS}"
 echo "</table>"
 echo "<a href=\"https://github.com/za3k/za3k.com/tree/master/cgi-bin/service.status.d\">[Source]</a>"
 echo "</body>"