| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# diffuse command on each nodes |
| 4 |
# Script is run under uid of oar who is sudo |
| 5 |
# argv[1] is the file which contains the list of nodes used |
| 6 |
# argv[2...] is the command to run on each node |
| 7 |
|
| 8 |
#exit |
| 9 |
|
| 10 |
#Exemple for mono processor cluster |
| 11 |
#SENTINELLE=/usr/bin/sentinelle |
| 12 |
SSH=ssh |
| 13 |
NODEFILE=$1 |
| 14 |
shift |
| 15 |
CMD=$@ |
| 16 |
|
| 17 |
if [ "a$SENTINELLE" != "a" ] |
| 18 |
then |
| 19 |
echo "Launch $CMD on each nodes with sentinelle" |
| 20 |
for i in `sort -u $NODEFILE` |
| 21 |
do |
| 22 |
NODESENTINELLE="$NODESENTINELLE -m $i" |
| 23 |
done |
| 24 |
echo "$SENTINELLE -cconnect=$SSH,timeout=30000 $NODESENTINELLE -- $CMD" |
| 25 |
$SENTINELLE -cconnect=$SSH,timeout=30000 $NODESENTINELLE -- "$CMD" |
| 26 |
else |
| 27 |
echo "Launch $CMD on each nodes with ssh" |
| 28 |
for i in `sort -u $NODEFILE` |
| 29 |
do |
| 30 |
($SSH $i "$CMD" || echo "/!\\ SOMETHING GOES WRONG WITH $i, exit_code = $?") & |
| 31 |
done |
| 32 |
wait |
| 33 |
fi |
| 34 |
|