Error in crontab running topologyUpdater.sh

Hello,
I´m having a problem that can´t solve. I can run topologyUpdater.sh manually and get a correct answer to be listed, but when I configure it into the crontab it is not running. I have connected the /script/ to the $PATH and have checked all setting but not working.
In a log activated in the cron line, I get the error “You do not have a cardano-cli binary available in $PATH.” but if I check the $PATH it´s listed.
Any idea of what it could be happening or any other solution to keep updated the Relay into the network?

Many thanks in advance

Hello,
Can u show how u configured in crontab?
Also go to the folder where topology updater script is located and type pwd… that that path should be set in crontab;

eg:
25 * * * * /opt/cardano/cnode/scripts/topologyUpdater.sh

Cheers

Hello,
This is the line in crontab
25 * * * * /root/cardano-my-node/scripts/topologyUpdater.sh
and typing pwd to know the path is correct.

Thanks

Have you checked whether root can see cardano-cli?

Go to the folder where is ur script and type pwd…

Yes without any problem.
Captura

It´s correct. And if I run the script manually it works well.
Captura

and how it looks in crontab?
you don’t have a non-root user created?

If I try to download and run the updater from another user I get this error.
Could not find shelley genesis file in default location or ‘ShelleyGenesisFile’ from the node configuration file
It should be because the node installation is under root user.

when you execute a program (without specifying the path to it) the system searches through $PATH variable, examining each directory from left to right in the list, looking for a command that matches the command name you executed.

so, when you execute cardano-cli or cardano-node, the system looks for the file, and in your case, it hasn’t found in any of the directories.

you can check which paths are specified in the variable by executing:

echo $PATH

you can check if the system can find cardano-cli by typing:

type -p cardano-cli

most probably you don’t have the path set to the cardano-cli binary (executive) file.

please check where you have placed it, usually, it’s either in ~/.local/bin or ~/.cabal/bin

if it’s in ~/.local/bin, the to add a path to the $PATH variable you can execute this:
echo “export PATH=~/.local/bin:$PATH” >> ~/.bashrc
source ~/.bashrc
echo $PATH

and then check if you have set everything correctly:

type -p cardano-cli

if you see a path to the file, then you are good to go.

let me know if you need any further help

1 Like

It depends on the user that runs the cron job. What works for the current user, may not work for the cron job.

How about you do whoami or echo id -u in another cronjob (paralell to the one in trouble) tho check if this gives you the user that you expect.

The error message comes from here. As you can see, this first checks the CCLI variable like this …

#CCLI="${HOME}/.cabal/bin/cardano-cli"   

introspection of the $PATH is only the fallback. Therefore, it’s probably best to set CCLI to the absolute path of where your cardano-cli can really be found.

Also, please note, that guild-operators have changed their default branch from master to alpha. This is of course highly problematic, because everyone naively cloning this repository, will get some alpha (i.e. possibly broken) script.

When you install those scripts, clone like this …

git clone --depth 1 -b master https://github.com/cardano-community/guild-operators.git

Alternatively, you might prefer not to worry about all of this - no compile, no cabal, no fuzzing around with topology or live view (in alpha versions) - just run.

Yes, I have checked that before contacting because it can find the program cardano-cli from any directorie.
This is the result
root@serv3:~/cardano-my-node/scripts# echo $PATH
~/.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
root@serv3:~/cardano-my-node/scripts#

root@serv3:~/cardano-my-node/scripts# type -p cardano-cli
/root/.local/bin/cardano-cli
root@serv3:~/cardano-my-node/scripts#

I think that it´s correct.
Any idea?

Many thanks for your help

I have tried this and the resulta is root.

In your other line, I have checked but the folder bin with cardano-cli is not listed into /.cabal/ folder. I have made a copy of the /bin/ folder from /.local/ and the cron result now is this other.

Could not find shelley genesis file in default location or ‘ShelleyGenesisFile’ from the node configuration file

What do you suggest?

Many thanks for your help

Could not find shelley genesis file in default location or ‘ShelleyGenesisFile’ from the node configuration file

In your configuration file u have 2 paths … are correct?

I’d say @Alexd1985 is your man if you want to stick with your bare metal setup. He is brilliant and usually gets it working eventually when folks are in trouble. I personally prefer to have a docker image that I can just run. All those zillion build, install and setup steps should be done for me IMHO - like this for example. I can run this image on my Mac, on an AWS server and on a RaspberryPi just the same. Every SPO has his/her preferences I guess.

1 Like

Sorry Alex, which of the files you mean?

thanks

Thank you very much for your help

I think mainnet config :slight_smile:
Here are the paths to byron and shelley files

“ByronGenesisFile”: “/opt/cardano/cnode/files/byron-genesis.json”,

“ShelleyGenesisFile”: “/opt/cardano/cnode/files/genesis.json”,

these are my paths, you should check if your paths are correct

This is the mainnet-config.json and it´s in the same folder that mainnet-byron and mainnet-genesis…

“ByronGenesisFile”: “mainnet-byron-genesis.json”,

“ShelleyGenesisFile”: “mainnet-shelley-genesis.json”,

I think that the problem can be that I have got cardano-node in another user folder where I started to create de node intead than root folders.

so. your node is up and sync… the only issue is that your topologyupdater script doesn’t work in crontab right?