#!/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
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>"
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>"