Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- check_if_failed() {
- local _status="$1"
- if [ ! "$_status" = 0 ]
- then
- echo "FAILED!"
- exit 1
- fi
- }
- pids=()
- for host in $hosts
- do
- ssh -o ConnectTimeout=2 $host "
- set -e
- which parallel
- sleep 1
- " &
- pids+=("$!")
- done
- for pid in "${pids[@]}"
- do
- wait "$pid"
- check_if_failed "$?"
- done
- echo "All is good!"
- exit 0
Add Comment
Please, Sign In to add comment