X-Git-Url: https://gerrit.akraino.org/r/gitweb?p=ta%2Fremote-installer.git;a=blobdiff_plain;f=src%2Fscripts%2Fget_journals.sh;h=3511eab4f64575156f6a2299e0b3d9559371e81b;hp=343a6389d6f6e5be16e93c73a8f0c32a890c9c14;hb=5529dff990973f223eeff6601da4f466fead6a32;hpb=7e8b4725c4934c2cd2bd62a5dc2c1f423e9b602d diff --git a/src/scripts/get_journals.sh b/src/scripts/get_journals.sh index 343a638..3511eab 100644 --- a/src/scripts/get_journals.sh +++ b/src/scripts/get_journals.sh @@ -14,11 +14,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -hosts=$(python print_hosts.py) -for host in $hosts; do +hosts_names_file="$1" +for host in $(cat ${hosts_names_file}); do if [ "${host}" != "$(hostname)" ]; then - ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ServerAliveInterval=60 ${host} "sudo journalctl" > /tmp/journal_${host}.log - ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ServerAliveInterval=60 ${host} "sudo journalctl -o json" > /tmp/journal_${host}_json.log + address=${host} + if [ -e /etc/infra_internal_addresses ]; then + internal_ip=$(grep ${host} /etc/infra_internal_addresses | cut -d ' ' -f 2) + if [ -n "$internal_ip" ]; then + address=${internal_ip} + fi + fi + ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ServerAliveInterval=60 ${address} "sudo journalctl" > /tmp/journal_${host}.log + ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ServerAliveInterval=60 ${address} "sudo journalctl -o json" > /tmp/journal_${host}_json.log else sudo journalctl > /tmp/journal_${host}.log sudo journalctl -o json > /tmp/journal_${host}_json.log