libretime/analyzer/tools/test-hook-script.sh

21 lines
440 B
Bash
Raw Normal View History

#! /bin/bash
post_file() {
2021-08-16 13:45:32 +02:00
file_path=${1}
filename="${file_path##*/}"
2021-05-27 16:33:20 +02:00
2021-08-16 13:45:32 +02:00
#kill process after 30 minutes (360*5=30 minutes)
max_retry=10
retry_count=0
2021-08-16 13:45:32 +02:00
until curl --max-time 30 http://localhost/rest/media -u 3188BDIMPJROQP89Z0OX: -X POST -F "file=@${file_path}" -F "name=${filename}"; do
2021-08-16 17:44:19 +02:00
retry_count=$((retry_count + 1))
2021-08-16 13:45:32 +02:00
if [ $retry_count -ge $max_retry ]; then
break
fi
sleep 1
done
}
post_file "${1}" &