diff --git a/inotify.sh b/inotify.sh index 5c263dd..e2b1d33 100644 --- a/inotify.sh +++ b/inotify.sh @@ -15,15 +15,18 @@ inotifywait -m "$WATCH_PATH" -e close_write | file_size=$(stat -c%s "$file_path") num_chunks=$(( (file_size + chunk_size - 1) / chunk_size )) - for (( i=0; i/dev/null | curl \ - --location "$UPLOAD_URL" \ + dd if="$file_path" bs=$chunk_size skip=$i count=1 2>/dev/null | \ + curl --location "$UPLOAD_URL" \ --header "Authorization: Bearer $AUTH_TOKEN" \ --form "recording_id=${id}" \ --form "chunk_index=${i}" \ --form "total_chunks=${num_chunks}" \ --form "FILE=@-" + + i=$(( i + 1 )) done fi done