#!/bin/bash source /home/apu/testbed_files/apu-tb-opt/scripts/mesh/node_addresses.sh ssh_user="root" # Converts a host number (e.g. 0 for apu00) to the corresponding IP address get_ip() { local host_number=$1 if [[ $host_number -lt 10 ]];then clt_current=apu0$host_number else clt_current=apu$host_number fi local host_ip="${eth0IP[$clt_current]}" # echo "$host_ip" >&2 echo "$host_ip" } # Checks whether the ptp4l instance is running ssh_ptp4l_check() { local host local host_ip host_ip=$(get_ip "$1") if [[ $1 -lt 10 ]];then host=apu0$1 else host=apu$1 fi if ssh "${ssh_user}@${host_ip}" "pgrep 'ptp4l' > /dev/null"; then # echo "PTP4l is running on apu$1 with IP ${host}." echo "$host ptp4l running" return else # echo "PTP4l is NOT running on ${host}." echo "$host ptp4l NOT running" fi } for node in {0..24}; do ssh_ptp4l_check "$node" done