I am using a login-script, to check for newer installed (but currently not running) eeprom and kernel..
It should be also possible to use it as a cron-job and create a little login-notification or send mails, etc. if /var/run/reboot-required exists..
this script is not optimized, just wrote it quick n dirty..
currently i have put the script it in my home-bin-directory and start it via. .bashrc-file like:
.bashrc:reboot-notification.sh:
It should be also possible to use it as a cron-job and create a little login-notification or send mails, etc. if /var/run/reboot-required exists..
this script is not optimized, just wrote it quick n dirty..
currently i have put the script it in my home-bin-directory and start it via. .bashrc-file like:
.bashrc:
Code:
...[ -x ~/bin/reboot-notification.sh ] && ~/bin/reboot-notification.sh
Code:
#!/bin/bash### eepromecho checking firmware:rpi-eeprom-updatecurrenteeprom=$(rpi-eeprom-update |grep CURRENT | grep -o \(.*\) | tr -d "()")latesteeprom=$(rpi-eeprom-update |grep LATEST | grep -o \(.*\) | tr -d "()")if [ $currenteeprom != $latesteeprom ]then echo newer firmware found sudo touch /var/run/reboot-requiredfiif [ $currentkernel = $latestkernel ]then echo firmware is up2datefi### kernelecho checking kernel:currentkernel=$(uname -r | cut -d "-" -f1)echo running kernel: $currentkernellatestkernel=$(ls -la /boot/vmlinuz* --sort time | cut -d "/" -f 3 |cut -d "-" -f 2 |head -1)echo latest installed kernel: $latestkernelif [ $currentkernel != $latestkernel ]then echo newer kernel found sudo touch /var/run/reboot-requiredfiif [ $currentkernel = $latestkernel ]then echo kernel is up2datefi### check if reboot neededif [ -f /var/run/reboot-required ]then echo "[*** Hello $USER, you must reboot your machine ***]"fi
Statistics: Posted by zenhighzer — Fri Apr 26, 2024 8:59 am