1

I see that unattended-upgrades issues shutdown -r command with the scheduled time. However, the PC is sleeping at that time. It also doesn't restart after manual wakeup. This is for a computer novice user (grandma), she most certainly forgets to restart it every week or so. And i don't want to restart it immediately to avoid interrupting her work, so decided to do it in the middle of the night.

UPDATE: Grandma wakes the PC from sleep with some random button, most certainly the power button.

Lyubomir
  • 95
  • 1
  • 9

1 Answers1

1

"Reboot required" is indicated by the existence of the files /var/run/reboot*.

You could create a root cron job (note: root's crontab is a different format, read man 5 crontab), to run at 4AM and do something like:

#!/bin/bash
zz="$(find /var/run -type f -name 'reboot*')"
[[ -n "$zz" ]] && shutdown -r +10 
waltinator
  • 35,099
  • 19
  • 57
  • 93
  • Thank you for the reply! Is this going to work even if the PC is sleeping at 4AM? – Lyubomir Nov 14 '20 at 22:17
  • 1
    No. When a PC is sleeping/suspended/hibernating, nothing takes place, no programs are run. If, however, you mean "screen locked", it will run. How does grandma begin "work" in the morning? Power button or mouse move? – waltinator Nov 15 '20 at 04:04
  • Added info to question. – Lyubomir Nov 15 '20 at 08:47