amelioration hostname et csv

This commit is contained in:
2021-02-23 10:58:09 +01:00
parent 9921222131
commit 5b642806b1

View File

@@ -1,17 +1,18 @@
#! /bin/bash #! /bin/bash
set -euo pipefail set -eu
IFS=$'\n\t' IFS=$'\n\t'
source functions.sh source functions.sh
echo -ne "host\tname\troot history\tbash history\t<+CHANGEME+>\n" echo -ne "host;name;root history;bash history;<+CHANGEME+>\n"
for host in /srv/lxc/ipi/ipi_g1*/rootfs ; do for host in /srv/lxc/epsi/b2/* ; do
root=${host} root=${host}/rootfs
#host=$(basename $host) host=$(basename $host)
hostname=$(grep HOSTNAME ${root}/etc/sysconfig/network | cut -f2 -d=) hostname=$(grep HOSTNAME ${root}/etc/sysconfig/network 2>/dev/null| cut -f2 -d=)
test -z "${hostname}" && hostname=$(cat ${root}/etc/hostname) test -z "${hostname}" && hostname=$(cat ${root}/etc/hostname)
test -f ${root}/etc/motd && user="$(cat ${root}/etc/motd | sed 's/\n//')\t" test -f ${root}/etc/motd && user="$(cat ${root}/etc/motd | xargs)"
echo -ne "${hostname}\t${user}" test -z "$user" && continue
fileMTime ${root}/root/.bash_history echo -ne "${hostname};${user};"
fileMTime ${root}/home/formation/.bash_history fileMTime ${root}/root/.bash_history
fileMTime ${root}/home/formation/.bash_history
echo echo