drigato 2fdc4291e3 CC-5708: proftpd hook for new File API
testing ftp hook script
2014-03-27 16:48:57 -04:00

22 lines
476 B
Bash
Executable File

#! /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" &