Update system_needs_reboot to use perl call to check kernel boot/running version.
whmapi1 system_needs_reboot can currently return the wrong kernel running_version information inside an AlmaLinux 8 LXC. (It returns the correct information inside CentOS 6 and 7 LXCs.)
As a cPanel System Administrator, I would like it to incorporate a perl call (example in Refs:) such that it returns the correct kernel running_version. This will benefit everyone who uses whmapi1 system_needs_reboot, as API1 won’t be returning wrong information.
Personally this is of high importance as it’s the API I use to trigger email alerts when a server needs to be rebooted. I expect many (most?) developer centric cPanel System Administrator use the same call for similar server automation.
CentOS 7 will reach EOL June 30, 2024. AlmaLinux 8 (EOL 2029) is the suggested replacement.
Code Refs:
On a SolosVM, QEMU
# cat /etc/redhat-release AlmaLinux 8
# uname -r 4.18.0-372.9.1.el8.x86_64
# /usr/sbin/whmapi1 system_needs_reboot --- data: details: kernel: boot_version: 4.18.0-372.9.1.el8.x86_64 running_version: 3.10.0-1160.el7.x86_64 needs_reboot: 1 metadata: command: system_needs_reboot reason: OK result: 1 version: 1
# /usr/local/cpanel/3rdparty/bin/perl -MData::Dumper -MCpanel::Kernel::Status -le 'print Dumper( Cpanel::Kernel::Status::kernel_status(updates => 1));' $VAR1 = { 'reboot_required' => '', 'running_version' => '4.18.0-372.9.1.el8.x86_64', 'update_available' => undef, 'running_latest' => 1, 'has_kernelcare' => 0, 'boot_version' => '4.18.0-372.9.1.el8.x86_64' };
Link Refs:
https://api.docs.cpanel.net/openapi/whm/operation/system_needs_reboot/
https://docs.cpanel.net/knowledge-base/general-systems-administration/linux-containers/
Replies have been locked on this page!