fix path
This commit is contained in:
parent
97d5bf3960
commit
dae6a03006
1 changed files with 4 additions and 6 deletions
10
inotify.sh
10
inotify.sh
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin/bin
|
|
||||||
|
|
||||||
inotifywait -m /out -e close_write |
|
inotifywait -m /out -e close_write |
|
||||||
while read PATH ACTION FILE; do
|
while read PATH ACTION FILE; do
|
||||||
|
|
||||||
|
@ -21,7 +19,7 @@ inotifywait -m /out -e close_write |
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Dateigröße ermitteln
|
# 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 ))
|
num_chunks=$(( (file_size + chunk_size - 1) / chunk_size ))
|
||||||
|
|
||||||
# Datei in Chunks hochladen
|
# Datei in Chunks hochladen
|
||||||
|
@ -32,13 +30,13 @@ inotifywait -m /out -e close_write |
|
||||||
temp_chunk_file="/tmp/chunk_$i"
|
temp_chunk_file="/tmp/chunk_$i"
|
||||||
|
|
||||||
# Chunk erstellen
|
# 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
|
# Überprüfen, ob der Chunk erfolgreich erstellt wurde
|
||||||
if [ -f "$temp_chunk_file" ]
|
if [ -f "$temp_chunk_file" ]
|
||||||
then
|
then
|
||||||
# Chunk hochladen
|
# Chunk hochladen
|
||||||
curl --location "$UPLOAD_URL" \
|
/usr/bin/curl --location "$UPLOAD_URL" \
|
||||||
--header "Authorization: Bearer $AUTH_TOKEN" \
|
--header "Authorization: Bearer $AUTH_TOKEN" \
|
||||||
--form "recording_id=${id}" \
|
--form "recording_id=${id}" \
|
||||||
--form "chunk_index=${i}" \
|
--form "chunk_index=${i}" \
|
||||||
|
@ -46,7 +44,7 @@ inotifywait -m /out -e close_write |
|
||||||
--form "file=@$temp_chunk_file"
|
--form "file=@$temp_chunk_file"
|
||||||
|
|
||||||
# Temporäre Datei löschen
|
# Temporäre Datei löschen
|
||||||
rm "$temp_chunk_file"
|
/bin/rm "$temp_chunk_file"
|
||||||
else
|
else
|
||||||
echo "Fehler beim Erstellen des Chunks $i"
|
echo "Fehler beim Erstellen des Chunks $i"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue