File: oar_diffuse_script

package info (click to toggle)
oar 2.5.4-2
  • links: PTS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 11,064 kB
  • sloc: perl: 28,891; ruby: 5,813; sh: 5,208; ml: 3,408; sql: 3,255; cpp: 2,277; ansic: 702; makefile: 389; php: 99; exp: 23
file content (35 lines) | stat: -rwxr-xr-x 845 bytes parent folder | download | duplicates (9)
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
# $Id$

# diffuse command on each nodes
# Script is run under uid of oar who is sudo
# argv[1] is the file which contains the list of nodes used
# argv[2...] is the command to run on each node

#exit

#Exemple for mono processor cluster
#SENTINELLE=/usr/bin/sentinelle
SSH=ssh
NODEFILE=$1
shift
CMD=$@

if [ "a$SENTINELLE" != "a" ]
then
    echo "Launch $CMD on each nodes with sentinelle"
    for i in `sort -u $NODEFILE`
    do
        NODESENTINELLE="$NODESENTINELLE -m $i"
    done
    echo "$SENTINELLE -cconnect=$SSH,timeout=30000 $NODESENTINELLE -- $CMD"
    $SENTINELLE -cconnect=$SSH,timeout=30000 $NODESENTINELLE -- "$CMD"
else
    echo "Launch $CMD on each nodes with ssh"
    for i in `sort -u $NODEFILE`
    do
        ($SSH $i "$CMD" || echo "/!\\ SOMETHING GOES WRONG WITH $i, exit_code = $?") &
    done
    wait
fi