4
0

backupScript.sh 475 B

1234567891011121314151617181920
  1. #!/bin/bash
  2. echo "Starting backup script"
  3. # Demo behaviour: 50% finish in 9 seconds (within the 10s action timeout),
  4. # 50% run for 15 seconds (typically times out).
  5. if (( RANDOM % 2 == 0 )); then
  6. maxFiles=9
  7. echo "Demo: backup will finish in 9 seconds"
  8. else
  9. maxFiles=15
  10. echo "Demo: backup will run for 15 seconds (may exceed the action timeout)"
  11. fi
  12. for fileIndex in $(seq 1 "$maxFiles"); do
  13. echo "Backing up file: $fileIndex"
  14. sleep 1
  15. done
  16. echo "All files backed up"