This commit is contained in:
holzi1005 2025-01-07 18:24:46 +01:00
parent 97d5bf3960
commit dae6a03006

View file

@ -1,7 +1,5 @@
#!/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin/bin
inotifywait -m /out -e close_write |
while read PATH ACTION FILE; do
@ -21,7 +19,7 @@ inotifywait -m /out -e close_write |
fi
# Dateigröße ermitteln
file_size=$(stat -c%s "$file_path")
file_size=$(/bin/stat -c%s "$file_path")
num_chunks=$(( (file_size + chunk_size - 1) / chunk_size ))
# Datei in Chunks hochladen
@ -32,13 +30,13 @@ inotifywait -m /out -e close_write |
temp_chunk_file="/tmp/chunk_$i"
# Chunk erstellen
dd if="$file_path" bs=$chunk_size skip=$i count=1 of="$temp_chunk_file" 2>/dev/null
/bin/dd if="$file_path" bs=$chunk_size skip=$i count=1 of="$temp_chunk_file" 2>/dev/null
# Überprüfen, ob der Chunk erfolgreich erstellt wurde
if [ -f "$temp_chunk_file" ]
then
# Chunk hochladen
curl --location "$UPLOAD_URL" \
/usr/bin/curl --location "$UPLOAD_URL" \
--header "Authorization: Bearer $AUTH_TOKEN" \
--form "recording_id=${id}" \
--form "chunk_index=${i}" \
@ -46,7 +44,7 @@ inotifywait -m /out -e close_write |
--form "file=@$temp_chunk_file"
# Temporäre Datei löschen
rm "$temp_chunk_file"
/bin/rm "$temp_chunk_file"
else
echo "Fehler beim Erstellen des Chunks $i"
fi