needrestart icon indicating copy to clipboard operation
needrestart copied to clipboard

How to get a simple Boolean output?

Open zilexa opened this issue 2 years ago • 1 comments

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.

zilexa avatar Jun 27 '23 20:06 zilexa

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.

liske avatar Aug 06 '23 17:08 liske