Crontab cannot run cardano-cli

Hey everyone,

We have a pool running since last Thursday and we were surprised yesterday as we noticed that our transactions had suddenly stopped. We continue to be connected to 20 peers, but it seems to have no impact on restarting our transactions. We´ve tried to run the topologyUpdater.sh manually 4 times (as requested) and we get the following message:

{ “resultcode”: “204”, “datetime”:“2020-11-22 15:14:53”, “clientIp”: , “iptype”: 4, “msg”: “glad you’re staying with us” }

So it seems topologyUpdater.sh is running correctly when ran in cmd cli. The issue seems to be with cron scheduler.

Whenever we try to run topologyUpdater.sh through cron, we get an error message as follows:

{ “resultcode”: “502”, “datetime”:“2020-11-22 01:19:47”, “clientIp”: , “msg”: “invalid blockNo ” }

We then receive a mail from Cron Daemon saying that:

/bin/sh: cardano-cli: command not found

We don´t find any explanation for this to be happening since cardano-cli is installed in our machine. It seems as cron doesn´t have the clearence to run topologyUpdater.sh even after running chmod -x topologyUpdater.sh.

We´re kinda lost at this point. Does any one have any idea on how we might solve this?

Thanks

Try to put the full path of cardano-cli into your crontab.

hi @riverpoolcrypto,

I hope this finds you well. As @waldmops suggested, put absolute paths everywhere. In the crontab, but also in the file you wish the cron daemon to execute for you, eg:

#in the crontab

35 * * * * /path/to/your/topologyUpdater.sh >> /path/to/a/log/for/cron

#in topologyUpdater.sh

CNODE_HOSTNAME=“CHANGE ME” # (Optional) Must resolve to the IP you are requesting from
CNODE_LOG_DIR="/path/to/log/dir" # Folder where your logs will be sent to (must pre-exist)
CNODE_VALENCY=1 # (Optional) for multi-IP hostnames
CNODE_TOPOLOGY="/path/to/your/new/topology/file.json" # Destination topology.json file you’d want to write output to
MAX_PEERS=15 # Maximum number of peers to return on successful fetch
#CUSTOM_PEERS=“None” # Additional custom peers to (IP:port[:valency]) to add to your target topology.json, eg: "10.0.0.1:3001|10.0.0.2:>

The above has worked for me, I was getting the same headache with trying to execute topologyUpdater.sh with cron.

Hope this helps,

Adrem [RABIT]

PS welcome to the forum!

Hey @waldmops and @Adrem,

Thank you very much for you quick response! Good to be part of this community!

We’ve defined the absolute paths on both files but we still have some conflicts with libsodium versioning. This time, cron seems to find cardano-cli but is not able to execute it. We receive the following error message:

/user/.local/bin/cardano-cli: error while loading shared libraries: libsodium.so.23: cannot open shared object file: No such file or directory

We’re now trying to fix this conflicts and hopefully solving our problems.

Thanks for your help!

Riverpool Team

no worries mate,

Sometimes what you described happened when the library path did not load correctly (irrespective of how you’re executing cardano-cli).

See how you go with something like this:

echo export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" >> $HOME/.bashrc

#then

source .bashrc

Cheers,

Adrem [RABIT]

.bashrc will not necessarily work in the crontab context, but there are ways to set environment variables there as well. If all else fails, just call a shell script from crontab which sets all necessary environment variables. If I’m not mistaken, cardano-cli also needs a variable pointing to the node socket for certain operations.

Hey,

We couldn´t make it work with cron, even after adding the full path to our crontab file, so we’ve replaced it with a Python scheduler which is working fine since last night. It’s not the same solution but it does the job.

Thanks for all your help!