Ubuntu has a script that is called when a reboot is required. You can make this script do whatever you want:
vim /usr/share/update-notifier/notify-reboot-required