’cron’ stops working after an Android start from CE
I have seen that every time I start Android from CoreELEC and then return to CoreELEC with a normal restart, ‘cron’ stops working.
I have seen this because among the tasks that I run in ‘cron’ is this line that runs every 15 minutes:
*/15 * * * * date > /storage/cron_test
When I see that ‘cron’ has stopped working I have to edit the list of tasks ‘cron’ with crontab -e (without making any modification) to work again. This happens with any version of CoreELEC 9.x that I know.
then I started Android (latest stock firmware) from CoreELEC and then I went back to CoreELEC with a normal restart and CRON HAS STOPPED WORKING (and the LED of my KIII PRO has changed to red).
Now ‘cron’ does not work, it seems that if CoreELEC (the disk drive) is exposed to the Android stock firmware of KIII Pro, then ‘cron’ stops working. Maybe what happens is that ‘cron’ does not find the task file, but if I write ‘crontab -l’ it’s there. To solve the problem I have to edit ‘crontab -e’ changing something but leaving everything the same.
This is what it is:
CoreELEC:~ # systemctl status cron -l --no-pager
● cron.service - Cron daemon
Loaded: loaded (/usr/lib/systemd/system/cron.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2015-01-01 01:00:25 CET; 4 years 4 months ago
Process: 2723 ExecStartPre=/bin/mkdir -p /storage/.cache/cron/crontabs (code=exited, status=0/SUCCESS)
Main PID: 2751 (crond)
Memory: 104.0K
CGroup: /system.slice/cron.service
└─2751 /sbin/crond -f -S
Jun 22 13:11:53 CoreELEC systemd[1]: Starting Cron daemon...
Jan 01 01:00:25 CoreELEC systemd[1]: Started Cron daemon.
May 22 14:31:58 CoreELEC crond[2751]: time disparity of 2307631 minutes detected
Adding ‘systemctl restart cron’ to ‘/storage/.config/autostart.sh’ has not solved the problem either. It seems that Android modifies something, which affects ‘cron’ and the color of the LED of the KIII PRO device.
How can I start ‘cron’ with a specific task file to add it to ‘/storage/.config/autostart.sh’?
Can you add this before crontab line crontab -l >/storage/cron.list
and check what the result in file would be? Maybe your problem is that entries are lost somehow?
Bumping this old topic.
I’m running the latest 9.2.4.2 version and I also see this issue.
I tried several actions, all with no effect:
restarting crontab service on the command line
stopping and starting crontab service on CoreElec user interface
The one that makes cron running again is openting crontab and force saving it.
I noticed that when crontab is saved, there’s a new cron.update file created under the folder .cache/cron/crontabs/
with root inside.
I tried to manually create this file, with the same content, and it is also not enough to fix it.
The only automated workaround I found that works is to add the following 2 lines to the autostart.sh script: crontab -l > /storage/.config/cron.tab crontab /storage/.config/cron.tab
There’s no need to restart the service.
This issue only happens when it reboots to Android and then back to CoreElec. If the reboot is only done from CoreElec to CoreElec it does not happen as long as cron is running before the reboot.
I run it on a Alfawise H96 Pro+ box.
modem2k, I just tried this and could replicate (on Beelink GS King X). Cron runs just fine after booting to Android and back to CoreELEC. Maybe there is some interaction with Android and CE on this specific box you have.
In the past I had problems with settings that run once waiting for CoreELEC to remember this on every boot or reboot (for example cron and zerotier). I don’t know what it depends on but sometimes CoreELEC forgets these settings or it doesn’t behave as expected.
My solution is to include in autostart.sh all the additional settings that all the services use in their operation without waiting for CoreELEC to remember them between two consecutive starts.