Exit code
pjvds opened this issue · 4 comments
It would be very helpful if nvchecker return a non succeeding exit code value when where are updates found. This would help me detecting new version by running a cron job that reports "failure".
Reporting failure on updates seems weird. Instead you can run nvcmp
to output the updates. cron should mail the output to you.
I agree that it makes sense to use nvcmp
to check for updates. It still would make sense for nvcmp
to return an exit code reporting changes or not. Many tools do this, for example grep
returns 0 if selected lines are found, and 1 if not found. If an error occurred the exit status is 2 or higher. Note that POSIX error handling code should check for 2 or greater.
I'm considering adding a command line option (to nvcmp
) to use exit code to indicate if there are updates. What do you think? Do you have a good option name for it?
The grep
0/1 semantics sound fine to me: if nvcmp > nvcmp.out; then mail -s nvcmp operator@here < nvcmp.out; fi; rm nvcmp.out
... but it does make sense to make it optional in case somebody is using it in a set -e
shell script and doesn't expect it to do this.
How about --exit-status
?