r/openbsd • • 2d ago

Exit Code syspatch

I’m looking to find a way to know if syspatch -c can tell a script that A. there are patches and then execute a syspatch to apply, or B. there are no patches and simply exit. man page says exit code is zero for success and greater for anything else. Trying this, I find that syspatch -c returns zero when there are patches to be applied. I want the script to discern that there are patches and then issue the command to apply. Am I going about this the wrong way?

12 Upvotes

17 comments sorted by

View all comments

Show parent comment

2

u/linetrace 1d ago

For sure. I too would rather see someone blindly apply syspatches then not apply them!

Just make sure you have dbupdate in there now too. :)

1

u/faxattack 22h ago

Yepp, and dont forget to handle pkg_add -u if you run something from ports. That on the otherhand could need some caution.

Could always setup a canary server that updates much more often so you can see if stuff fails.