¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Pi reboot


 

My Pi 3b is rebooting every night at midnight. I would like to turn that off. There is nothing in crontab about rebooting. My question is, where else can I look in the Pi to find the script that is ordering the reboot? Thanks for your help. KD9CCE?


 

The reboot may not be called direct with a cronjob but another script that is called may include the reboot command. Have you looked through the scripts that are called? If you want to post your cronjobs, I'll be happy to see if anything jumps out at me. Just run:

crontab -l

--
73, de KM4ACK
|
|


 

Jason, this is what I have:?

pi@aprs1:~ $ crontab -l
# Edit this file to introduce tasks to be run by cron.
#?
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#?
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#?
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#?
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#?
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#?
# For more information see the manual pages of crontab(5) and cron(8)
#?
# m h? dom mon dow? ?command
@reboot sleep 120; export DISPLAY=:0 && lxterminal -t "Dire Wolf" -e "/usr/local/bin/direwolf"
#0****export DISPLAY=:0 && lxterminal -t "Dire Wolf" -e "/usr/local/bin/direwolf"
#15****export DISPLAY=:0 && lxterminal -t "Dire Wolf" -e "/usr/local/bin/direwolf"
#30****export DISPLAY=:0 && lxterminal -t "Dire Wolf" -e "/usr/local/bin/direwolf"
#45****export DISPLAY=:0 && lxterminal -t "Dire Wolf" -e "/usr/local/bin/direwolf"
?
#start conky at boot
@reboot sleep 20 && export DISPLAY=:0 && /usr/bin/conky
?
#start tightvncserver at boot
#@reboot sleep 20 && export DISPLAY=:0 && /usr/bin/tightvncserver
#@reboot? /usr/bin/tightvncserver :1
#@reboot /usr/bin/vncserver :1
#@reboot sleep 90 && export DISPLAY=:0 && /usr/bin/vncserver :1
?
#reboot daily at 23:00
#00 23 * * * sudo reboot?
?
*/5 * * * * sudo /usr/bin/autohotspotN >/dev/null 2>&1
pi@aprs1:~ $?
?


 

That's looks like a pretty custom setup and you didn't use Build a Pi? I don't see anything in your cron that would be calling another script that would reboot the machine. My only other guess at the moment is that maybe you have something in root's cron that might be doing it. You can see root's cron by running:
sudo crontab -l
--
73, de KM4ACK
|
|


 

No crontab for root.?

I will ask around some more and let you know what I find thank you.


 

Debugging spurious reboots can be tedious and time-consuming.? Your goal is to find some cookie crumbs that will lead you to the culprit.? Unfortunately, there are many ways to reboot a system.

- Make sure there are no other user accounts with cron jobs:
sudo ls /var/spool/cron/crontabs

If anything besides 'pi' turns up, dump out its cron entries with (replace <id> appropriately):
sudo crontab -lu <id>

- Examine syslog very carefully for any error indications just prior to midnight.? You can dump the log to a file with:?journalctl > /tmp/logdump? If the system is being commanded to reboot, there should be messages with "Stopped" or "Stopping" as the reboot begins executing.? Another log to examine would be /var/log/kern.log.

- Replace?reboot and?shutdown with scripts that dump out system state, then continue on with the restart.? A sample of how to do this with reboot:
cd /usr/sbin
sudo mv reboot reboot.orig
sudo vi reboot
ps -ef > /home/pi/reboot.ps
sudo reboot.orig
:wq
sudo chmod a+x reboot

When a script executes 'reboot' it will first dump out 'ps'.

To change back to the original reboot:

cd /usr/sbin
sudo mv reboot.orig reboot



 

Thank you for this. The logdump file that is created is only capturing an hour or so of activity, and the kern.log appears to overwrite at midnight. How can I capture more logging time with these? Thank you.?


 

Log files in /var/log should be rotated at midnight. There usually is no limit to the size of these logs.? Can't remember exactly how to check it (ulimit?).??

Another source of scheduled-at-midnight cron jobs (I forgot about this previously) are defined in /etc/cron.daily.? That's where the call to logrotate should be.? I wonder if some other daily script is forcing the reboot?