Exit codes are not documented in the man page
kpinc opened this issue · 4 comments
Hi,
There is no documentation of needrestart's exit codes. At least not in the man page needrestart(1). Knowing exit codes could be useful. For example, when writing a shell script to email needrestart output (Issue# 24, email frontend #24) the exit code might reveal whether or not anything needs restarting and so whether or not to send an email.
I'm not sure needrestart exits differently than 0 by default (I've not made exhaustive tests though but right now it's exiting 0 should my user session is running outdated binaries or not...).
However, you can activate nagios mode with -p switch (equivalent of -t switch with checkrestart) and then you have different exit codes, nagios-compatible, depending on the situation.
Those return codes are documented by Nagios itself here: https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/pluginapi.html