Skip to content

Instantly share code, notes, and snippets.

@CansecoDev
Created December 1, 2018 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CansecoDev/9c11fe35aab90da92df141a0938f87dd to your computer and use it in GitHub Desktop.
Save CansecoDev/9c11fe35aab90da92df141a0938f87dd to your computer and use it in GitHub Desktop.
Checking if the system needs a reboot (same as the login motd)
#!/bin/bash
function needsRebootUpdate() # Returns OK if system needs to reboot
{
if [ -f /var/run/reboot-required ]
then
exit 0
else
exit 1
fi
}
if [ needsRebootUpdate ]; then echo "Reboot required"; fi # Test
@CansecoDev
Copy link
Author

  • Also, this could be added to .bashrc so I can use rr in future sessions for this purpose
    alias rr='if [ -f /var/run/reboot-required ]; then echo "Reboot required"; else echo "No reboot needed"; fi'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment