Closed safanaj closed 3 years ago
Would be good if using the CNODE_PID variable (detected) the scripts would find the exact executable for the running process using something like
The CNODE_PID is found using grep for [c]ardano-node.*.port.. So your suggestion would not work.
I think we could add a change for being able to specify exact path & binary name in env file (similar to CCLI , but for node)
On the other hand, only one process can listed to the EKG or Prometheus port and we can get it's PID, for example: PID=$(fuser -n tcp $PROM_PORT | cut -f 2)
Hmm, but EKG_PORT/PROM_PORT are derived from CONFIG, which is captured from command line used to run the node (if a custom CONFIG isnt specified). Because users can accidentally rush into running node without modifying configs/paths/env correctly (based on countless support requests), the flow was adopted to:
I suppose if we had to use port to check process, we could go for node listen port itself (for which we'd have to use ss -tlnp "sport = :${CNODE_PORT}" | grep LISTEN | sed -e 's/.*.pid=\(.*\),.*/\1/g'
and fallback to lsof -i -P -n | grep ${CNODE_PORT}.*.LISTEN |awk '{print $2}'
instead of fuser, since fuser may not be present on all flavour of Linux - while ss/lsof is used by gLiveView as well.
But then we'd need cardano-node
process name for cnode.sh
itself - that's used to start the node. Hence, if we'd have to cater for node binary name regardless, I think existing solution works best if adapted to allow specifying node binary name via env
file?
Well, if you have the PID, you can easily get the name of the process: "ps -p $PID -o comm". But yes, if you need to start the process to begin with, then the name of the executable needs to be specified in env.
Describe the bug the gLiveView.sh script is detecting a wrong version of cardano-node in case of the running node process is executed using a binary named differently than cardano-node. In case of multiple version installation, like
cardano-node-X.Y.Z
andcardano-node
the gLiveView.sh script is not able to detect the correct version assuming that there is an executable named cardano-node.To Reproduce
cardano-node
cardano-node-1.29.0
cardano-node-1.29.0
Additional context I found useful to maintain installed several version of cardano-node and cardano-cli installed on my nodes, an during some testing upgrades or other migrations I don't want to have to stick to a binary named
cardano-node
The issue is caused by this lines:
Would be good if using the CNODE_PID variable (detected) the scripts would find the exact executable for the running process using something like: