-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrust.sh
executable file
·83 lines (71 loc) · 2.13 KB
/
rust.sh
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
#./rust.sh 1
machine="/etc/ansible/hosts" # "machines_g5k.txt"
if [ ! -f "$machine" ]; then
echo "Le fichier $machine n'existe pas."
exit 1
fi
machines=()
while IFS= read -r line; do
machines+=("$line")
#ansible-playbook test.yml \
#--extra-vars "node=$line target=$line ansible_user=root"
done < "$machine"
a=${#machines[@]}
numberofexpe=132
numberpermachine=$(echo "scale=0; $numberofexpe/10 / 1" | bc)
echo "array length $a and $numberpermachine processes"
copy_file="${1:-0}"
if [ $copy_file -eq 0 ]; then
for element in "${machines[@]}"; do
ansible-playbook playbook/rust_project_setup.yml \
--extra-vars \
"node=$element target=$element ansible_user=root"&
done
fi
rep=1
if [ $copy_file -eq 1 ]; then # expe
count=0
while [ $count -lt $numberofexpe ];
do
index=$(($count % $a))
element=${machines[$index]}
echo "-------["$element"] --> count"$count
echo "-------["$element"] --> count"$count >> log.txt
ansible-playbook playbook/expe.yml \
--extra-vars \
"node=$element target=$element ansible_user=root begin=$count rep=$rep end=$count" &
let count=count+1
done
fi
dir="/home/amukam/thss/simulation/Aupe"
if [ $copy_file -eq 2 ]; then # collect
for element in "${machines[@]}"; do
ansible-playbook playbook/collect_play.yml \
--extra-vars \
"node=$element target=$element ansible_user=root dir=$dir" &
done
fi
if [ $copy_file -eq 22 ]; then # collect
fold="${2:-"global"}"
for element in "${machines[@]}"; do
ansible-playbook playbook/recup.yml \
--extra-vars \
"node=$element target=$element ansible_user=root dir=$dir origin=$fold" &
done
fi
if [ $copy_file -eq 3 ]; then # clean
for element in "${machines[@]}"; do
ansible-playbook playbook/clean_play.yml \
--extra-vars \
"node=$element target=$element ansible_user=root" &
done
fi
if [ $copy_file -eq 4 ]; then #stop
# Display the elements in the array
echo "Elements read from the file:"
for element in "${machines[@]}"; do
echo "$element"
done
echo "array length $a and $numberpermachine processes"
fi