2014-03-27 21:48:57 +01:00
|
|
|
#! /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
|
2014-03-27 21:48:57 +01:00
|
|
|
|
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
|
2014-03-27 21:48:57 +01:00
|
|
|
}
|
|
|
|
|
2014-03-28 17:26:40 +01:00
|
|
|
post_file "${1}" &
|