Unverified Commit 69bca546 authored by David Beniamine's avatar David Beniamine
Browse files

Show logs after upgrade

parent 297dd285
......@@ -79,6 +79,8 @@ do
then
answer $logfile
else
# Choose last log file with desired host
logfile=$(grep -l $name /var/log/upgrade_all.sh_* | sort | tail -n 1)
tempfile="/tmp/$$"
# Extract the pertinent part of the log
awk 'BEGIN{IN=0} /Begin host/{if($4=="'$name'"){IN=1}} {if(IN){print $0}} /End host/{if($4=="'$name'"){IN=0}}' \
......
......@@ -235,7 +235,13 @@ if(!isset($action)){
$lines = array();
exec("../scripts/actions.sh ".escapeshellarg($action)." "
.escapeshellarg($name), $lines, $code);
echo "<p>Action effectuée, code : $code</p>";
echo "<p>Action '$action' effectuée, code : $code</p>";
// Retrieve logs
if(preg_match('/^upgrade/', $action) && $code == 0 ){
echo "<p>Les logs ne se rafraichissent pas tous seuls, vous pouvez utiliser le bouton prévu à cet effet</p>";
exec("../scripts/actions.sh getLog "
.escapeshellarg($name), $lines, $code);
}
if(!empty($lines)){
echo "<pre>";
foreach($lines as $line){
......@@ -245,6 +251,13 @@ if(!isset($action)){
}else{
echo "<p>Erreur : pas de réponse</p>";
}
?>
<form action="index.php" method="post">
<input type="hidden" name="action" value="getLog">
<input type="hidden" name="name" value="<?php echo $name; ?>">
<input type="submit" value="Rafraichir les logs" title="Rafraichir les logs">
</form>
<?
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment