Yes, just that. And the thing is that If I run the topologyUpdater.sh manually it works well.
ok
try this, go in your folder where your script working manually
type echo $PATH
wthat is the result? can u paste here?
Yes, It´s the same that I pasted before. This is the result.
~/.local/bin:/root/.local/bin:/root/.local/bin:/root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
Thanks
strange …
can you try in crontab like this?
25 * * * * cd /root/cardano-my-node/scripts/ && ./topologyUpdater.sh
there are 2 commands, first will move in scripts folder and second will call topology script
or
25 * * * * /bin/bash /root/cardano-my-node/scripts/topologyUpdater.sh
both worked for me
Cheers,
Hi, when you run crontab try to include
-u root
Best,
Johann
Nothing, it´s not working with this config either.
It´s very extrange this problems as it´s happening only with this script.
Many thnaks
From where did u get the script? Can u send the link?
I took it from here
It is ok, I.m using also that script, I took a look inside the env file and it seems ur error is generated from there:
[[ -z “{CCLI}" ]] && CCLI=(command -v cardano-cli)
if [[ -z “{CCLI}" ]]; then
if [[ -f "{HOME}/.cabal/bin/cardano-cli” ]]; then
# Assumption being made that cardano-cli and cardano-node are both present, if not - prereqs and build instructions were not followed
export PATH=”${HOME}/.cabal/bin":PATH
CCLI=(command -v cardano-cli)
else
echo “You do not have a cardano-cli binary available in $PATH.”
return 1
fi
… so something wrong with your paths,
type “command -v cardano-cli” check te path and perhaps you should edit in env file
1st line (delete # to make it active)
#CCLI="${HOME}/.cabal/bin/cardano-cli" # Override automatic detection of path to cardano-cli executable
in my case:
:/opt/cardano/cnode/scripts$ command -v cardano-cli
/home/test/.cabal/bin/cardano-cli
opt/cardano/cnode/scripts$ cd /home/test/.cabal/bin/
:~/.cabal/bin$ ls -l
total 477744
Dec 10 01:04 cardano-cli
Dec 10 01:04 cardano-node
Dec 10 01:04 cardano-node-chairman
Dec 10 01:04 cardano-ping
Nov 15 23:33 chairman
Dec 10 01:04 db-analyser
Dec 10 01:04 db-converter
Nov 28 18:55 tracer-transfomers-example1
Nov 28 18:55 tracer-transfomers-example2
As I started to install all with a user but finally finished with another, I think that the error has been there.
What finally I have done has been to reinstall it all and working well now the relay and the script too.
The problem should have been with the path but couldn´t solve it copying folders and files, so as the node is new, I solved it like this better.
Thank you very much for your help Alex.
Congratulations @Alexd1985, you’ve won
thank you, I saw, I am so happy, I am waiting for an opportunity like this since September … maybe now delegators will understand that CHRTY it is a trust pool and they will join … thx again
Hi, I have problems with the cronjob on my second relay.
My node is running fine with relay 1 and I upgraded it with a relay 2 recently.
Installation went smooth and relay is running and connected. topologyUpdater.sh can be executed in the terminal and I get the expected feedback “glad you stay…” “one per hour please…”
I setup a cronjob like on my other relay but it’s not executed. Means the “…lastresult.json” is not updated from conjob executions.
Here’s the cronjob -e content:
03 * * * * /home/tom/cardano-my-node/topologyUpdater.sh
I even tried this:
47 * * * * cd /home/tom/cardano-my-node/ && ./topologyUpdater.sh
but without success
this is what the “sudo grep CRON /var/log/syslog” gives me:
Jan 25 20:47:01 vps2249119 CRON[43892]: (tom) CMD (cd /home/tom/cardano-my-node/ && ./topologyUpdater.sh)
→ so I see the cronjob is doing something but somehow the lastresult.json is not updated
Is it probably due to permissions?
Here’s the output of ls -l:
-rwxrwxr-x 1 tom tom 4246 Jan 25 20:02 topologyUpdater_lastresult.json
any idea is appreciated…
Thanks in advance,
Thomas
I don’t actually use that particular topologyUpdater.sh script - I have my own.
However, I am aware that that script does use a number of variables that it loads from an environment file. I think you will find that your problem is related to the variables not being set because your path is incorrect for the user running the script.
Your cron job is likely running as user root. Whereas when you run the command yourself you are running it as your user?
Maybe investigate your problem using that line of thinking.
Hi,
I think I found the problem. Or at least nailed it down a bit…
When executing the topologyUpdater from terminal everything went fine, but cronjob didn’t work. I put a cronjob in etc/crontab and then I got more logs to analyse. There, I saw the issue might be related to mainnet-shelley.json as mentioned by previous persons in this threat. So, I instead of rebuilding everything I decided to download a different topology updater. For cardano-node I followed the guide on coincashew but the topology is from guild so I needed to change some of the config. But hey, this works now Even my logs go now in a different folder, but that doesnt matter
Regards,
Thomas
Lessons learnt:
- all logs must be checked (really all)
- different crontabs may help to get more info
- try different topologyUpdater.sh scripts
Here is an example bash script for pinging api.clio.one with your relay details:
#!/bin/bash
set -o nounset
set -o errexit
set -o pipefail
CNODE_HOME='/opt/cardano' #FIXME
export CARDANO_NODE_SOCKET_PATH='/run/cardano/mainnet-node.socket' #FIXME
service_url='https://api.clio.one/htopology/v1/'
shelley_genesis="${CNODE_HOME}/etc/mainnet-shelley-genesis.json" #FIXME
nwmagic="$(jq -r '.networkMagic' "$shelley_genesis")"
hostname="$(hostname -f)"
port=3000 #FIXME
function send_topology() {
# Sometimes cardano socket recreated causing broken pipe so try 5 times
local count=0
while
if (( ++count > 5 )); then
echo 'Error: send_topology(): cardano-cli failed' >&2
return 1
fi
local blockNo="$(cardano-cli query tip --mainnet 2>/dev/null | jq -r '.block')"
[[ -z "${blockNo:-}" ]]
do sleep 1; done
local response="$(curl -sf -4 "${service_url}?port=${port}&blockNo=${blockNo}&valency=1&magic=${nwmagic}&hostname=${hostname}")"
echo "$response"
}
send_topology || exit 1
exit 0
Just set the variables at the top and call this script every hour with your cron job. Ensure that $PATH includes location of cardano-cli executable. Also you must have jq and curl installed.