Page 1 of 1

/etc/crontab/root

Posted: Fri Jun 07, 2019 1:20 pm
by G8351427
Hoping to find out what this is.

I found the following items in /etc/crontab/root :

Code: Select all

0 3 * * * sleep 70 && touch /etc/banner && reboot -f
0,10,20,30,40,50 * * * * /usr/lib/custom/johns_ping.sh
I am not much of a Linux guy, but I can Google pretty hard, so if I understand correctly, crontab is like a task scheduler of sorts. I know what the second item is because I saw it referenced here.

So I think I have figured out that I have two tasks scheduled to run, one of which is the ping script that is present on the WiFix builds of ROOTer and the other looks like it is rebooting the router every day at 3am, based on the syntax of the task.

I guess this explains why my router is rebooting every day at 3am. While troubleshooting that problem, I checked the scheduled tasks tab in Luci and there is nothing listed, so it was not apparent what was causing the problem.

So.. two things:
  1. It seems that the chrontab jobs are not appearing in the scheduled tasks section in ROOter Luci. I am not sure of that is a bug or by design.
  2. I am not sure why there is a job set to reboot the router every day. This seems like something the end user should have control over and should be disabled by default. Further, I didn't find any docs or notes about this feature, and the way it's been implemented seems like a problem since it's not user-facing and you basically need to be a Linux guru to find it.
Anyway. I presume I can delete that root file, since I don't want either of those two tasks running.

Re: /etc/crontab/root

Posted: Fri Jun 07, 2019 3:12 pm
by swwifty
Yes, delete that file. Not sure why both of those would be included by default, unless setup via the GUI.

Re: /etc/crontab/root

Posted: Wed Dec 16, 2020 10:31 pm
by xdavidx
For anyone else who runs across this post, here is some added information that might help.

Your router may be set to UTC time by default. For me, in US Central Standard Time right now, that means 6 hours earlier than UTC time. My router rebooted at 9 pm (and had been doing so since I put it into service this past weekend, without me knowing). I looked at the system logs (which get wiped on each reboot, so won't show if anything bad happened before the reboot) and noticed the timestamps were UTC time (3 am).

I set the router to my timezone (America/Chicago, which is central time) and synced the clock to my computer time (there is a button in the router UI to automatically do this). This is in the System->System screen. The log files now show the correct timestamps (Status->System log).

I then went hunting for forum posts about reboots and found this thread. This is the second time I've been down this path, but forgot, since it was 1.5 years ago since I first set up my system.

I tried to use the System->Custom Commands->Scripts screen to load the root file from /etc/crontab, as mentioned in this post subject line, but it didn't work. I ended up using ssh to connect to the router and searched for the root file. I found it in /etc/crontabs (note the "s", whereas the subject of this thread is just "crontab" without the "s").

If you go to System->Custom Commands->Scripts and put /etc/crontabs in the "Path to Script:" line and "root" in the Script Name: line, and hit the load button, you'll see the two scheduled events from the first post in this thread.

You can then edit it and resave it if you'd like, or delete it, or just look at it. I like that it will reboot every day at 3 am, in case there is instability in the firmware. As long as 3 am isn't 9 pm, that works for me. :-)

The other line in the file pings the google dns server (8.8.8.8 address) every 10 minutes. If it fails, it retries up to 20 times, with 10 seconds in between each time. If all those retries fail, then it will either try to reset the modem (if it is able to find the correct commport that the modem is on) or will perform a router reboot.