microscope-data / upload.sh
Robert Azarcon
Add splats batch 20260516_032605
28ab604
#!/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