Friday, April 17, 2026

Re: bad exit value for "rcctl ls failed"

On 16.4.2026 06:21, Harald Dunkel wrote: > This looks weird: > > gate5b# rcctl ls failed > smtpd > gate5b# x=$(rcctl ls failed) && rcctl restart $x > gate5b# rcctl ls failed > smtpd > gate5b# echo $? > 1 > WTH? > gate5b# x=$(rcctl ls failed) || rcctl restart $x > smtpd(ok) > gate5b# rcctl ls failed > gate5b# echo $? > 0 > > This is confusing. Imagine grep would exit 1 if it has found > something. https://man.openbsd.org/rcctl EXIT STATUS rcctl action returns with the exit status of the rc.d(8) daemon script. rcctl get daemon | service [status] exits with 0 if the daemon or service is enabled and 1 if it is not. rcctl getdef daemon | service [status] exits with 0 if the daemon or service is enabled by default and 1 if it is not. rcctl ls failed | rogue exits with 1 if an enabled daemon is not running or vice versa. Otherwise, the rcctl utility exits with 0 on success, and >0 if an error occurs (2 indicates a non-existent daemon | service). > > > Regards > Harri

No comments:

Post a Comment