freifunk-saar / ff-node-monitor

Monitoring for Freifunk nodes
GNU Affero General Public License v3.0
3 stars 2 forks source link

cron is not running correctly #32

Closed rubo77 closed 6 years ago

rubo77 commented 6 years ago

On my system the cron looks ok:

# sudo crontab -l -u ff-node-monitor                                                                                                                                    
*/5 * * * *    http://localhost:8833/cron

but it doesn't seem to run as user ff-node-monitor. There is no meshviewer.json updated.

If I run this this command as root it works fine:

curl http://localhost:8833/cron

But this could have set the downloaded file owner to root somehow?

Where do I have to look? Where is the json file downloaded?

RalfJung commented 6 years ago

There is no file being downloaded, all this does is trigger the cron path on the server which then will do all the actual work. There is also no meshviewer.json being created or updated. Why do you think that it does not seem to run correctly?

rubo77 commented 6 years ago

The node I monitor is still shown as offline. Although it is back online since hours

rubo77 commented 6 years ago

It was the same before: although I turned it off, it kept being shown online for hours in my settings page, until I called the curl command as root

RalfJung commented 6 years ago

The user running the curl command really cannot matter -- the only thing that matters is making a request to the URL.

What happens when you manually do cron as non-root? Does it say anything on the console?

rubo77 commented 6 years ago

it is really strange, if i call https://freifunk.in-kiel.de/knotenalarm/cron in the brower it updates the status correctly too

seems like the crontab of the user ffnode-monitor is not being executed or it has a problem there. I will check later today

RalfJung commented 6 years ago

If this is inside some kind of minimal system, maybe there is no cron daemon running?

All right, I will then close this issue as the problem is likely not caused by ff-node-monitor itself. If you find a solution, it might still be interesting to post it here for the sake of others running into the same problem!

rubo77 commented 6 years ago

I try to replace the user crontab with an entry in the normal crontab and call curl as root there:

I add the file /etc/cron.d/ff-node-monitor:

#PATH=/usr/sbin:/usr/bin:/sbin:/bin

*/5 * * * *  root  http://localhost:8833/cron

# EOF
rubo77 commented 6 years ago

This didn't work either, but now I found out why both didn't work:

I forgot the curl command!!!!

with this line it works fine:

*/5 * * * *  curl  http://localhost:8833/cron
RalfJung commented 6 years ago

D'oh, I did not see this either. :) Glad you got it solved!