iquidus / explorer

An open source block explorer
BSD 3-Clause "New" or "Revised" License
750 stars 1.33k forks source link

Crontab can't sync blocks #499

Closed Nectum8 closed 1 year ago

Nectum8 commented 1 year ago

Hi,

I have my explorer working without problems except that the latest transaction table is not updating with my cron job.

/1 cd /root/explorer && /usr/bin/nodejs scripts/sync.js index update > /dev/null 2>&1 /1 cd /root/explorer && /usr/bin/nodejs scripts/sync.js masternodes > /dev/null 2>&1

If I excecute the command manually it works fine, but never update the latest transactions with the cron job. The explorer sync the blocks fine, because i can see it in the left bottom corner, also i have the right connections. The other cron jobs works fine, because i can see the masternodes online and all ther stuff.

Any idea why is not working? I tried to find the index.pid but i have not the file. In my tmp folder:

delete.me pm2-0.pid pm2-1.pid pm2-2.pid pm2-3.pid

uaktags commented 1 year ago

What repo are you using as base (the official doesn't have masternodes)? You may want to ask the repo where you got the code from.

Otherwise, you can change up your crontab to actually output something to a log and then check the log. You could do something like this (untested, im on my phone right now)

/1 * cd /root/explorer && /usr/bin/nodejs scripts/sync.js index update >> /root/explorer/tmp/cron.log 2>&1

If i didn't mistaken anything above, the idea would be to redirect the output to a cron.log file in the tmp directory (whereas by default we always redirect to /dev/null to discard it.

Try that (or edit first if its incorrect) and see what comes out of it.

Nectum8 commented 1 year ago

Sorry i forget to update the issue. I was using mongodb DB 3.6 version and a nodejs old version so i tried to delete everything and did a fresh new installation, installing first the recommended versions, and everything works fine with the default crontab jobs.

Thank you very much for you help.

uaktags commented 1 year ago

Perfect, glad that worked out!