You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

21 lines
468 B

  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. INPUT="$1"
  4. STAGING="$2"
  5. OUTPUT="$3"
  6. while true ; do
  7. echo "[Stager] Attempting to move files..."
  8. COUNT=$(find "$INPUT" -type f | wc -l)
  9. if [[ $COUNT -ne 0 ]]; then
  10. echo "[Stager] Found $COUNT files!"
  11. echo "[Stager] Moving from input to staging..."
  12. mv -v "$INPUT"/* "$STAGING/" || true
  13. echo "[Stager] Atomically moving from staging to output..."
  14. mv -v "$STAGING"/* "$OUTPUT/" || true
  15. fi
  16. sleep 30
  17. done