File size: 822 Bytes
09204af 0a1c2c3 09204af 0a1c2c3 09204af 28ab604 09204af 0a1c2c3 09204af | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #!/bin/bash
# Uploads new images to Hugging Face repo every 5 minutes if there are changes.
# Usage: Go to terminal, go to microscope-data directory, and run `./upload.sh`
# If you don't want computer to turn off during long uploads:
# systemd-inhibit bash upload.sh
#!/bin/bash
INTERVAL=310
while true; do
if [[ -n $(git status --porcelain) ]]; then
echo "[$(date)] Adding and committing..."
git add .
git commit -m "Add splats batch $(date +%Y%m%d_%H%M%S)"
else
echo "[$(date)] Nothing new to commit."
fi
echo "[$(date)] Pushing..."
push_output=$(git push 2>&1)
echo "$push_output"
if echo "$push_output" | grep -q "Everything up-to-date"; then
echo "[$(date)] All done, everything is up to date!"
break
fi
echo "[$(date)] Waiting ${INTERVAL}s..."
sleep $INTERVAL
done |