forked from UCL/GERun
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgecp
More file actions
executable file
·35 lines (25 loc) · 837 Bytes
/
Copy pathgecp
File metadata and controls
executable file
·35 lines (25 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# This script uses qrsh to perform a cp command on each
# node that a user has allocated.
# This is useful for populating $TMPDIR on multiple nodes.
# Dr Owain Kenway, UCL
# For licensing terms, see LICENSE.txt
if [[ ! -d "$TMPDIR" ]]; then
echo "Error: no TMPDIR set: gecp cannot find \$TMPDIR/machines"
exit 2
fi
if [[ ! -r "$TMPDIR/machines" ]]; then
echo "Error: no machinefile: gecp cannot find $TMPDIR/machines"
exit 3
fi
sort -u "$TMPDIR/machines" > "$TMPDIR/uniqmachines"
echo "Using nodes:" >&2
cat "$TMPDIR/uniqmachines" >&2
declare -a pids
for node in $(cat "$TMPDIR/uniqmachines"); do
# TODO Think of a way to fix this --v
# WARN: This will break if any of the command line arguments contain spaces
qrsh -inherit "$node" "cd \"$(pwd)\"; /bin/cp $*" &
pids+=("$!")
done
wait "${pids[@]}"