#!/usr/bin/env bash # https://www.linuxjournal.com/content/validating-ip-address-bash-script function valid_ip() { local ip=$1 local stat=1 if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then OIFS=$IFS IFS='.' ip=($ip) IFS=$OIFS [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \ && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]] stat=$? fi return $stat } PUB_IP=$(wget -qO- https://api.ipify.org) if valid_ip $PUB_IP; then echo "MYIP = $PUB_IP" else echo "NO valid public IP found: $PUB_IP" exit 1 fi if [ -z "$NODE_ACCOUNT_ID" ]; then echo "No account id." exit 2 fi harmony -log_folder log -bootnodes $BN_MA -ip $PUB_IP -port $NODE_PORT -account_index $NODE_ACCOUNT_ID # vim: ai ts=2 sw=2 et sts=2 ft=sh