I have a weather station that sends data to a Raspberry PI, in which runs a linux server that takes that data and stores it. Everythings works fine except for one little thing. Raspberry is connected to the weather station indoor display, via usb cable. The display is set to reproduce sounds whenever it powers up. So basically, every night at 3 am I am woken up by this sound. I then connected via ssh to the Raspberry and entered this command to access log, to see what was happening at that time:
nano /var/log/syslog
And i found this line:
Jul 21 02:53:01 weatherstation CRON[25991]: (root) CMD (sudo reboot)
This repeats every day at the same time. So, apparently I have something in crontab that keeps rebooting my raspberry. Obviously it's ok if the device reboot to just chill for a moment, but it's not ok to do it at 3am lol.
I then opened:
nano /etc/crontab
And I found these 4 lines:
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
So there is no clear sudo reboot, but I suspect that something inside /etc/cron.daily is executing that instruction. So I opened the folder cron.daily and inside I found these files:
apache2 apt-compat aptitude bsdmainutils cracklib-runtime dpkg exim4-base logrotate man-db passwd
The only file that seemed interesting for me was apt-compat
. In there I found this:
# run daily job
exec /usr/lib/apt/apt.systemd.daily
The problem is, this file is too complicated for me. I don't know the programming language used inside it, and I don't know what is technically doing. So I want just to shift the reboot time from 3am to like 10am, but I can't understand how.
Thanks you all for your attention.
/etc/cron.d/
would be the place to look. Also usually you don't have system-provided stuff there, but there could be stuff in root's personal crontab too (in/var/spool/cron/crontabs/
on my Debian, or just runcrontab -l
as root). If all that fails, thengrep -re "sudo reboot" /etc
or so.) – ilkkachu Jul 21 '21 at 19:59