diff --git a/python_apps/airtime_analyzer/tools/ftp-upload-hook.sh b/python_apps/airtime_analyzer/tools/ftp-upload-hook.sh index f5be38183..0174f9a07 100755 --- a/python_apps/airtime_analyzer/tools/ftp-upload-hook.sh +++ b/python_apps/airtime_analyzer/tools/ftp-upload-hook.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#!/bin/bash -xv post_file() { #kill process after 30 minutes (360*5=30 minutes) @@ -28,7 +28,9 @@ post_file() { api_key=$(awk -F "= " '/api_key/ {print $2}' $instance_conf_path) - until curl --max-time 30 $url -u $api_key":" -X POST -F "file=@${file_path}" -F "full_path=${file_path}" + # -f is needed to make curl fail if there's an HTTP error code + # -L is needed to follow redirects! (just in case) + until curl -fL --max-time 30 $url -u $api_key":" -X POST -F "file=@${file_path}" -F "full_path=${file_path}" do retry_count=$[$retry_count+1] if [ $retry_count -ge $max_retry ]; then