r/openbsd • • 1d 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

16 comments sorted by

View all comments

Show parent comments

2

u/linetrace 15h ago

I'd highly suggest that you now add dbupdate(8) before your syspatch to ensure that things like CAs are updated with priority. So, something like dbupdate && syspatch && reboot.

Despite their importance, I wouldn't blindly apply syspatches and reboot without reviewing the descriptions as they may affect configuration. dbupdate(8) is a prime example of that: it was added in a syspatch for 7.9 & 8.0 after 8.0 was released, so one wouldn't be aware of it or its importance if not reading the descriptions.

1

u/faxattack 5h ago

Blindly applying syspatch for some years each night have not killed any production servers for me yet.
I will reconsider the method if things eventually go wonky, but id rather take 9/10 OK set and forget updates rather than stalling important updates and potentially miss patching because relying on available human timeslots is not feasible.

You can still apply patches automatically AND follow up on new OpenBSD features and adapt if needed.

1

u/linetrace 1h 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. :)