Skip to content
Snippets Groups Projects
Verified Commit cfd7d528 authored by David Beniamine's avatar David Beniamine
Browse files

Actually do something on upgradeAll

parent 472c8d94
No related branches found
No related tags found
No related merge requests found
......@@ -45,12 +45,44 @@ broadcast=$(ip a | awk '/inet.*eth1/ {print $4}' | cut -d / -f 1)
wait_time=120
wait_step=5
cmd="cd /opt/primtux-eole/; export HTTPS_PROXY='http://dnsproxy:3128'; git pull; ./upgrade-session.sh $1"
if [ ! -z "$2" ]
then
# $1 == Apt, $2 == hostname or $@ == command
if [ "$1" == "Apt" ]
then
arg="apt"
host="$2"
else
arg="$@"
fi
elif [ ! -z "$1" ]
then
# $1 == Apt, hostname or $@ == command
if [ "$1" == "Apt" ]
then
arg="apt"
elif [ ! -z "$(grep $1 /etc/registry/hosts)" ]
then
host="$1"
else
arg="$@"
fi
fi
cmd="cd /opt/primtux-eole/; export HTTPS_PROXY='http://dnsproxy:3128'; git pull; ./upgrade-session.sh $arg"
echo $cmd
declare -A HOSTS
declare -A IPTOMACS
declare -A DOWNS
while read date mac name
if [ -z "$host" ]
then
catcmd="cat $conf_file"
else
catcmd="grep $host $conf_file"
fi
while read date mac name endline
do
# Boot machine
if [ ! -z "$date" ]
......@@ -62,9 +94,9 @@ do
wakeonlan -i $broadcast "$mac"
done
sleep 5
MACS+=" $mac"
MACS="$MACS $mac"
fi
done < $conf_file
done < <($catcmd)
# Wait for boot
log "Wakeonlan sent, waiting"
......
......@@ -27,8 +27,4 @@ host=$subnet.52
echo $@ | netcat $host $port
# If action is "get" something, read answer
if [[ "$1" =~ "get" ]]
then
stdbuf -i0 -o0 -e0 $netcat
fi
stdbuf -i0 -o0 -e0 $netcat
......@@ -88,7 +88,9 @@ do
fi
elif [[ "$LINE" =~ "upgrade" ]]
then
#TODO call directly upgrade script
false
DIR="$(realpath $(dirname $0))/../../registry/scripts/"
subactions="$(echo $LINE | sed -e 's/^upgrade//' -e 's/All//')"
nohup $DIR/upgrade_all.sh $subactions &
echo "Started 'upgrade_all.sh $subactions' in background on $(date)" | answer
fi
done
......@@ -232,7 +232,7 @@ if(!isset($action)){
}else{
if(in_array($action, $allowedActions)){
$lines = array();
exec("../scripts/actions.sh .".escapeshellarg($action)." "
exec("../scripts/actions.sh ".escapeshellarg($action)." "
.escapeshellarg($name), $lines, $code);
echo "<p>Action effectuée, code : $code</p>";
if(!empty($lines)){
......@@ -242,11 +242,7 @@ if(!isset($action)){
}
echo "</pre>";
}else{
if(preg_match('/^getLog/', $action)){
echo "<p>Pas de log globaux disponibles</p>";
}else{
echo "<p>Not implemented yet</p><p>Cette action n'affiche pas de message.<br />Vous pouvez demander les logs depuis <a href='/wol/'>la page principale<a></p>";
}
echo "<p>Erreur : pas de réponse</p>";
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment