Due to frequent kernel updates, it is better to have previous kernels available to boot if something breaks in the new kernel. SO this method is not recommended for new users .
Using crontabs you can actually get what you want but not right after an update but at intervals
#!/bin/bash
# This script comes with no warranty ...use at own risk
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
LOG=/var/log
echo "--------------------------------------------------------------------------------" >> $LOG/grubby.log
echo "`date` - YUM UPDATE STARTED" >> $LOG/grubby.log
echo "`date` - *** CHECKING FOR YUM UPDATES ***" >> $LOG/grubby.log
$YUM -y update yum | awk '{x="'"`date`"'"; printf "%s - %s\n",x,$0 }' >> $LOG/grubby.log
echo "`date` - *** CHECKING FOR SYSTEM UPDATES ***" >> $LOG/grubby.log
$YUM -y update | awk '{x="'"`date`"'"; printf "%s - %s\n",x,$0 }' >> $LOG/grubby.log
echo "`date` - YUM UPDATE COMPLETED" >> $LOG/grubby.log
grub2-mkconfig -o /boot/grub2/grub.cfg | awk '{x="'"`date`"'"; printf "%s - %s\n",x,$0 }' >> $LOG/grubby.log
Then Edit Corntab
crontab -e
Then add your script to crontab
0 20 * * * /where-did-i-put-it/script.sh
Use the below synatx to help with adding your script to crontab
* * * * * /path/to/command.sh
- - - - -
| | | | |
| | | | +----- day of week (0 - 6) (Sunday=0)
| | | +------- month (1 - 12)
| | +--------- day of month (1 - 31)
| +----------- hour (0 - 23)
+------------- min (0 - 59)
P.S I am not proficient in scripting, please modify if you find something wrong
I'd write a bash script that does this.
what new entry is create above ?