Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
topologyUpdater.sh: Setting PATH trips some users, some other cleanup (…
…#276) * topologyUpdater.sh: Setting PATH trips some users, some other cleanup * Skip Hostname parameter if not specified: Since it is optional, and some miss to read instructions
- Loading branch information
Showing
1 changed file
with
10 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,29 @@ | ||
#!/bin/bash | ||
|
||
USERNAME="nonroot" # replace nonroot with your username | ||
USERNAME="${USERNAME}" # replace nonroot with your username | ||
|
||
CNODE_BIN="/home/${USERNAME}/.cabal/bin" | ||
CNODE_BIN="${HOME}/.cabal/bin" | ||
CNODE_HOME="/opt/cardano/cnode" | ||
CNODE_LOG_DIR="${CNODE_HOME}/logs/" | ||
|
||
CNODE_PORT=6000 # must match your relay node port as set in the startup command | ||
CNODE_HOSTNAME="myrelays.mydomain.com" # optional. must resolve to the IP you are requesting from | ||
CNODE_HOSTNAME="CHANGE ME" # optional. must resolve to the IP you are requesting from | ||
CNODE_VALENCY=1 # optional for multi-IP hostnames | ||
|
||
TESTNET_MAGIC=42 | ||
|
||
|
||
export DISPLAY=":0" | ||
export PATH="${CNODE_BIN}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | ||
export SHELL="/bin/bash" | ||
export PATH="${CNODE_BIN}:${PATH}" | ||
export CARDANO_NODE_SOCKET_PATH="${CNODE_HOME}/sockets/node0.socket" | ||
|
||
blockNo=$(cardano-cli shelley query tip --testnet-magic $TESTNET_MAGIC | grep -oP 'unBlockNo = \K\d+') | ||
|
||
# Note: | ||
# if you run your node in IPv4/IPv6 dual stack network configuration and want announced the | ||
# IPv4 address only please add the -4 parameter to the curl command below (curl -4 -s ...) | ||
if [ "${CNODE_HOSTNAME}" != "CHANGE ME" ]; then | ||
T_HOSTNAME="&hostname=${CNODE_HOSTNAME}" | ||
else | ||
T_HOSTNAME='' | ||
fi | ||
|
||
curl -s "https://api.clio.one/htopology/v1/?port=${CNODE_PORT}&blockNo=${blockNo}&hostname=${CNODE_HOSTNAME}&valency=${CNODE_VALENCY}&magic=${TESTNET_MAGIC}" | tee -a $CNODE_LOG_DIR/topologyUpdater_lastresult.json | ||
curl -s "https://api.clio.one/htopology/v1/?port=${CNODE_PORT}&blockNo=${blockNo}&valency=${CNODE_VALENCY}&magic=${TESTNET_MAGIC}${T_HOSTNAME}" | tee -a $CNODE_LOG_DIR/topologyUpdater_lastresult.json |