0

So I have an alias that I use for performing updates that cleans up old kernels and stuff. Problem is that it doesn't notify me immediately if a reboot is required afterwards. What can I use to figure this out so that I can at least print a message to the screen?

alias update='sudo apt-get update;sudo apt-get dist-upgrade;sudo apt autoremove;'
0

1 Answer 1

2

The package manager creates a file, /var/run/reboot-required, if the installation requires a reboot. This file is deleted when the machine is restarted.

3
  • Does it have a format or is it an empty file?
    – Xaxon
    Jun 13, 2017 at 16:13
  • After @Muru marked it as duplicate, I searched and found this.
    – user5325
    Jun 13, 2017 at 16:15
  • @Xaxon I believe it's empty, but you just need to check if it exists (e.g. with [ -f /var/run/reboot-required ]). Also BTW, you should write a function or a script, since they're much more flexible than aliases.
    – wjandrea
    Jun 13, 2017 at 17:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.