CC-5708: proftpd hook for new File API
testing ftp hook script
This commit is contained in:
parent
cc4e43a8b5
commit
2fdc4291e3
|
@ -0,0 +1,21 @@
|
||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
post_file() {
|
||||||
|
file_path=$1
|
||||||
|
filename="${file_path##*/}"
|
||||||
|
|
||||||
|
#kill process after 30 minutes (360*5=30 minutes)
|
||||||
|
max_retry=10
|
||||||
|
retry_count=0
|
||||||
|
|
||||||
|
until curl --max-time 30 http://localhost/rest/media -u 3TQY7JASUNVZ8IGOZQXJ: -X POST -F "file=@${file_path}" -F "name=${filename}"
|
||||||
|
do
|
||||||
|
retry_count=$[$retry_count+1]
|
||||||
|
if [ $retry_count -ge $max_retry ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
post_file "$1" &
|
Loading…
Reference in New Issue