From c03b50daa021d5a583923a582d8d7aa157885d59 Mon Sep 17 00:00:00 2001 From: sandbender Date: Sun, 13 Mar 2011 21:53:25 +0100 Subject: [PATCH] adding timeout to wget to prevent hanging process - we had such a weird state during - we think - server downtime --- scanner/pamela-scanner.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scanner/pamela-scanner.sh b/scanner/pamela-scanner.sh index f9df286..38501b4 100755 --- a/scanner/pamela-scanner.sh +++ b/scanner/pamela-scanner.sh @@ -32,6 +32,7 @@ USER='' PASSWORD='' TRANSLATE='' POST='' +TIMEOUT=200 function usage { echo "Usage: pamela-scanner [OPTIONS] @@ -141,14 +142,14 @@ function translate { TRANSLATE_URL=${TRANSLATE} TRANSLATE=$(mktemp) - wget --no-check-certificate --quiet -O "${TRANSLATE}" "${TRANSLATE_URL}" + wget --timeout="${TIMEOUT}" --no-check-certificate --quiet -O "${TRANSLATE}" "${TRANSLATE_URL}" POST=$(echo ${POST} | awk -v names="${TRANSLATE}" 'BEGIN { RS="\n" FS="," while ((getline nl < names) > 0) { split(nl, n); - nms[n[2]] = n[1] + nms[n[1]] = n[2] } close(names) RS="," @@ -169,9 +170,9 @@ function translate { function upload { if [ -z "${SIMULATE}" ] then - RESULT=$(wget "${OUT}" --no-check-certificate -O - --quiet --post-data "data=${POST}" --user "${USER}" --password "${PASSWORD}") + RESULT=$(wget "${OUT}" --timeout="${TIMEOUT}" --no-check-certificate -O - --quiet --post-data "data=${POST}" --user "${USER}" --password "${PASSWORD}") else - echo Not executing: [wget "${OUT}" --no-check-certificate -O - --quiet --post-data "data=${POST}" --user "${USER}" --password "${PASSWORD}"] + echo Not executing: [wget "${OUT}" --timeout="${TIMEOUT}" --no-check-certificate -O - --quiet --post-data "data=${POST}" --user "${USER}" --password "${PASSWORD}"] RESULT= fi