This repository was archived by the owner on Nov 21, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22
3+ # Path to sarjitsu.conf
34APP_CONF=conf/sarjitsu.conf
45
6+ # From 'curl' man pages:
7+ # "Maximum time in seconds that you allow curl's connection to take.
8+ # This only limits the connection phase, so if curl connects within
9+ # the given period it will continue - if not it will exit."
10+ TIMEOUT=10
11+
512log (){
613 echo -e " [$( date +' %D %H:%M:%S %Z' ) ] - $* "
714}
@@ -56,7 +63,24 @@ upload_em_all(){
5663 CMD+=" -F datafile=@$line "
5764 done < <( echo " $* " )
5865 log " attempting to upload file(s) to $APP_URL now.."
59- OUTPUT=$( curl -s $CMD -F ' check_all=check_all' -F ' cmd_mode=True' $APP_URL )
66+ log " Current connection TIMEOUT value: $TIMEOUT seconds.."
67+
68+ OUTPUT=$( curl --connect-timeout $TIMEOUT -s $CMD -F ' check_all=check_all' -F ' cmd_mode=True' $APP_URL )
69+
70+ if [[ -z $OUTPUT ]]; then
71+ CHECK_HOST=$( ping -c 1 $BACKEND_HOST | grep " 1 received" )
72+ if [[ -z $CHECK_HOST ]]; then
73+ log " $APP_URL is down."
74+ log " Check status of your BACKEND_HOST endpoint in conf/sarjitsu.conf"
75+ exit 1
76+ else
77+ log " $APP_URL is up and running, but for some reason, connection timed out. Try again?"
78+ exit -1
79+ fi
80+ else
81+ log " Files uploaded successfully.."
82+ fi
83+
6084 echo $OUTPUT | ./utils/vizit_results_parser.py
6185}
6286
You can’t perform that action at this time.
0 commit comments