needrestart
needrestart copied to clipboard
How to get a simple Boolean output?
Currently, when I run Needrestart after updating Manjaro Gnome via Pamac, this is the output:
Running kernel seems to be up-to-date.
The processor microcode seems to be up-to-date.
Restarting services...
Services to be restarted:
Restart «NetworkManager.service»? [yNas?] Service restarts being deferred:
systemctl restart NetworkManager.service
No containers need to be restarted.
User sessions running outdated binaries:
asterix @ user manager service: gnome-session-b[4807], gnome-shell[4867], systemd[4712]
No VM guests are running outdated hypervisor (qemu) binaries on this host.
What I am looking for is the following output (simple 0 or 1, y or n):
System needs to be restarted.
How can I get that? I don't need it to check for (docker) containers to be restarted. Perhaps that can be deleted via .conf file. Also I don't run VMs.
There is a nagios plugin mode which uses return codes to communicate the status. Depending how you define System needs to be restarted. you could use something like needrestart -p -k || echo old kernel, reboot required.