microscope-project/microscope-data
013k
1#!/bin/bash2 3# Uploads new images to Hugging Face repo every 5 minutes if there are changes.4# Usage: Go to terminal, go to microscope-data directory, and run `./upload.sh`5 6# If you don't want computer to turn off during long uploads:7# systemd-inhibit bash upload.sh8 9#!/bin/bash10 11INTERVAL=31012 13while true; do14 if [[ -n $(git status --porcelain) ]]; then15 echo "[$(date)] Adding and committing..."16 git add .17 git commit -m "Add splats batch $(date +%Y%m%d_%H%M%S)"18 else19 echo "[$(date)] Nothing new to commit."20 fi21 22 echo "[$(date)] Pushing..."23 push_output=$(git push 2>&1)24 echo "$push_output"25 26 if echo "$push_output" | grep -q "Everything up-to-date"; then27 echo "[$(date)] All done, everything is up to date!"28 break29 fi30 31 echo "[$(date)] Waiting ${INTERVAL}s..."32 sleep $INTERVAL33done