fi done
}
# Function teamBackup_log ( <message> )
# Writes messages to the log for the team backup operation.
function teamBackup_log { msg="$1"
echo "$msg" tee
}
# Function exitBackup ( <exitStatus> )
# Exits the backup.
function exitBackup {
[ $1
kill
}
#Function get ( <ipAddr> <authToken> <url> )
#Performs a GET.
|
|
| ||
function get { |
|
|
|
|
local getIP=$1 |
|
|
|
|
local getToken=$2 |
|
|
|
|
local getUrl=$3 |
|
|
|
|
local attempts=0 |
|
|
|
|
while [ $attempts |
|
| ||
curl | header | |||
request GET | url "$getUrl" |
| ||
errorCode=$? |
|
|
|
|
let "attempts = $attempts + 1" |
|
| ||
if [ 35 |
|
| ||
teamBackup_log "SSL error on GET of $getUrl, retrying... | " | |||
continue; |
|
|
|
|
fi |
|
|
|
|
break; |
|
|
|
|
done |
|
|
|
|
} |
|
|
|
|
|
|
|
#Function post ( <ipAddr> <authToken> <url> <data>)
#Performs a POST of the specified data.
|
|
|
| ||
function post { |
|
|
|
| |
local postIP=$1 |
|
|
|
| |
local postToken=$2 |
|
|
|
| |
local postUrl=$3 |
|
|
|
| |
local postData=$4 |
|
|
|
| |
local attempts=0 |
|
|
|
| |
while [ $attempts |
|
|
|
| |
postRes=`curl | header | ||||
request POST | url "$postUrl" | "$postData"` | |||
errorCode=$? |
|
|
|
|
|
let "attempts = $attempts + 1" |
|
|
| ||
if [ 35 |
|
|
| ||
teamBackup_log "SSL error on POST to $postUrl, retrying... | " | ||||
continue; |
|
|
|
|
|
fi |
|
|
|
|
|
break; done
echo $postRes
}
#Function put ( <ipAddr> <authToken> <url> <data> )
#Performs a PUT of the specified data.
function put { local putIP=$1 local putToken=$2 local putUrl=$3 local putData=$4 local attempts=0
while [ $attempts
putRes=`curl
let "attempts = $attempts + 1" if [ 35
teamBackup_log "SSL error on POST to $putUrl, retrying" continue;
fi break; done
echo $putRes
}
# Function extractJSONString ( <json> <fieldName> )
# Extracts the Json value corresponding to the field name.
124 Scripts