RUNNING_KERNEL=$(uname -r) REBOOT_KERNEL=$(file -bL /boot/vmlinuz-virt | sed 's/.*version //;s/ .*//') COUNTDOWN=$(($(date -d 23:59:59 +%s) - $(date +%s) + 1)) if test "$RUNNING_KERNEL" = "$REBOOT_KERNEL" ; then : else for FILE in $(find /dev/pts -perm /g+w -print); do echo -e "Broadcast message from $USER@$(hostname -s) ($(tty)) ($(date)):\n\n\\7\033[30;37;5mSystem will reboot at midnight for kernel update.\033[0m" > $FILE; done echo -e "*/print -current -tags notify_highlight Broadcast message from $USER@$(hostname -s) ($(tty)) ($(date)):" > /home/zachary/.weechat/weechat_fifo echo -e "*/print -current -tags notify_highlight " > /home/zachary/.weechat/weechat_fifo echo -e "*/print -current -tags notify_highlight -escape \\7\033[30;37;5mSystem will reboot at midnight for kernel update.\033[0m" > /home/zachary/.weechat/weechat_fifo reboot -d $COUNTDOWN & rm -rf /tmp/rebootneeded touch /tmp/rebootneeded fi