Solved: For new readers see SUMMARY below the original post below…
This has been a tug of war through the years. I get no light from the Debian folks on this issue, and I ask here as last resort to see if some brightspark dont maybe have a fix for this that the Debian/Cron folks dont know.
I ask at Debian and I filed bug reports at Cron. No answers regarding this matter.
Problem:
From Debian Distro to Distro Cron @reboot will work and then suddenly not work next version ON THE SAME FILE. It wreaks havoc with my cron scripts.
The same is with /etc/rc.local.
This time though, both of them dont work.
Anyone have an idea how I can get /etc/rc.local to execute at boot and how I can get cron @reboot to execute at boot.
I start to think that cron and the rc.local are maintained irresponsibly. So many systems rely on those functionalities and is crytical.
I am currently using Debian Stretch, where both are lightsout.
The manpage for stretch lists @reboot, so it wasnt removed.
“”
$ man 5 crontab |grep -i @reboot
@reboot Run once, at startup.
“”
etc.
Thanks.
========================================
Summary of solution
To summarize for anyone having the same problem with Debian and possibly other distros. This happens interchanging cron with fcron also. so it is valid for fcron too. Neither cron or fcron is at fault here. The problem is with anacron and how gnome starts it.
Check if both cron and anacron runs.
If both runs as below, I found the @reboot in the crontabfile will not execute.
ps-A |grep -i cron
1049 ? 00:00:00 anacron
1052 ? 00:00:00 cron
Only cron should run.
Also check runlevels with
chkconfig --list |grep -i cron
or
sysv-rc-conf --list |grep -i cron
There must be no mention of anacron
To get rid of anacron will mean you will loose gnome scheduler or whatever it is called. I never had use for it and I have a hunch that it is scheduler that installs anacron without regard for cron and breaks it.
To get rid of anacron
dmesg --purge anacron
then reboot and do the steps again until only cron runs as daemon.