From 0cdae0832a3355d4dbac934b270c097eeedbaf09 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Thu, 12 Dec 2024 18:39:50 +0200 Subject: Check first --- lib/_ak_network | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/lib/_ak_network b/lib/_ak_network index 898ef44..39f0466 100755 --- a/lib/_ak_network +++ b/lib/_ak_network @@ -357,24 +357,29 @@ _ak_network_scan(){ _ak_network_show_peers_stellar(){ stellarParticipants="$AK_WORKDIR/stellar-network-participants" stellarParticipantsOnline="$AK_WORKDIR/stellar-network-participants-online" + if [ -f "${stellarParticipantsOnline}" ] + then ( - printf '[' - counter=0 - cat $stellarParticipantsOnline | while read stellarAddress akConfig - do - if [ $counter -ne 0 ] - then - printf ',' - fi - counter=$(( $counter + 1 )) - akConfigHash="$(_ak_ipfs_name_resolve /ipns/$akConfig|cut -d '/' -f 3)" - printf '{"stellar":{"address":"%s","config":"%s"},"node_info":%s}' \ - "$stellarAddress" \ - "$akConfig" \ - "$(_ak_ipfs_cat $akConfigHash)" - done - printf ']' - ) | sed -e 's/\[]//g' #| jq + printf '[' + counter=0 + cat $stellarParticipantsOnline | while read stellarAddress akConfig + do + if [ $counter -ne 0 ] + then + printf ',' + fi + counter=$(( $counter + 1 )) + akConfigHash="$(_ak_ipfs_name_resolve /ipns/$akConfig|cut -d '/' -f 3)" + printf '{"stellar":{"address":"%s","config":"%s"},"node_info":%s}' \ + "$stellarAddress" \ + "$akConfig" \ + "$(_ak_ipfs_cat $akConfigHash)" + done + printf ']' + ) | sed -e 's/\[]//g' #| jq + else + _ak_log_debug "No stellar peers found" + fi } _ak_network_show_peers_cjdns(){ -- cgit v1.2.3