Endurain/auto-upload/watcher.sh hinzugefügt
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user