From 6293f9f889656b1be7e1f5915d9123018bddca01 Mon Sep 17 00:00:00 2001 From: David Beniamine <david.beniamine@tetras-libre.fr> Date: Mon, 5 Aug 2019 16:10:25 +0200 Subject: [PATCH] Remove ip from line --- registry/scripts/registry.sh | 3 ++- wol/www/index.php | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/registry/scripts/registry.sh b/registry/scripts/registry.sh index 725cf1e..8132341 100755 --- a/registry/scripts/registry.sh +++ b/registry/scripts/registry.sh @@ -47,11 +47,12 @@ do date=$(date +%Y%m%d) rIP=$(echo $line | cut -d ' ' -f 3) sline=$(echo $line | cut -d ' ' -f 1-2) + eline=$(echo $line | cut -d ' ' -f 4-) res=$(grep "$sline" $conf_file) if [ ! -z "$res" ] then # Update - sed -i -e "s/^.*$sline$/$date $line/" $conf_file + sed -i -e "s/^.*$sline.*$/$date $sline $eline/" $conf_file else # Add echo "$date $line" >> $conf_file diff --git a/wol/www/index.php b/wol/www/index.php index ef085d5..352fb66 100644 --- a/wol/www/index.php +++ b/wol/www/index.php @@ -79,18 +79,19 @@ if(!isset($action)){ foreach($lines as $line){ if($line != ""){ $entry=explode(' ', $line); + $nb_infos=count($entry); array_push($registry, $entry); - # Format date mac name ip [num_apt_upgrade deb_version pt_version git_branch git_update] + # Format date mac name [num_apt_upgrade deb_version pt_version git_branch git_update] ip echo "<tr>"; echo "<td>".$entry[2]."</td>"; - echo "<td> ".$entry[3]."</td>"; + echo "<td> ".$entry[$nb_infos-1]."</td>"; echo "<td>".$entry[1]."</td>"; #echo "<td>".$entry[0]."</td>"; - if(count($entry) > 4){ + if($nb_infos > 4){ + echo "<td>".$entry[4]."</td>"; echo "<td>".$entry[5]."</td>"; - echo "<td>".$entry[6]."</td>"; - echo "<td>".$entry[4]." mises à jour en attente</td>"; - echo "<td> branch ".$entry[7]." ".$entry[8]." commits en retard</td>"; + echo "<td>".$entry[3]." mises à jour en attente</td>"; + echo "<td> branch ".$entry[6]." ".$entry[7]." commits en retard</td>"; }else{ echo "<td>NA</td>"; echo "<td>NA</td>"; -- GitLab