Created
December 1, 2018 17:17
-
-
Save CansecoDev/9c11fe35aab90da92df141a0938f87dd to your computer and use it in GitHub Desktop.
Checking if the system needs a reboot (same as the login motd)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.bashrc
so I can userr
in future sessions for this purposealias rr='if [ -f /var/run/reboot-required ]; then echo "Reboot required"; else echo "No reboot needed"; fi'