A file at
/var/run/reboot-required is created that's used at login to tell you a restart is needed in the MOTD. You can check for the presence of this file to know if the updates you just did require a restart
To do something with this information we can wrap this in an if statement in BASH e.g:
if [ -f /var/run/reboot-required ] then echo 'Restart required' fi
Or as a one liner:
if [ -f /var/run/reboot-required ]; then echo 'Restart required'; fi
This just prints "Restart required" but you can do something else in place of the echo if you want.
Another tip, if you use Byobu, it will flag when a reboot is required.