Endurain/auto-upload/watcher.sh hinzugefügt

This commit is contained in:
2026-05-23 11:28:31 +02:00
parent 5434621d5f
commit b35b729f2f
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
source ~/cycling/.config
ACCESS_TOKEN=$(./login.sh)
inotifywait -m ~/cycling/inbox -e create |
while read path action file; do
FULLFILE="$path$file"
echo "Uploading: $FULLFILE"
RESPONSE=$(./upload.sh "$ACCESS_TOKEN" "$FULLFILE")
if echo "$RESPONSE" | jq -e '.id' >/dev/null; then
echo "OK"
mv "$FULLFILE" ~/cycling/uploaded/
else
echo "FAIL"
mv "$FULLFILE" ~/cycling/failed/
fi
done