Thanks. That's how I figured it too, which makes the return code as
useful as a chocolate teapot. I think most people would expect "service
start" to return success if the service was actually started, not that
an attempt to start it had been made. The service script returns the
result of an execv for the rc script. Looking at a few of the rc
scripts, some return a failure if they fail to start a service, others
return the return code of the final echo of the script (i.e. most likely
0). The jail script is one of these - it prints a "crashed and burnt"
message and then returns, by default, something likely to be 0.
The base system /etc/rc.d scripts do not seem to be consistent in how
they work or what they return at all, whereas the documentation
confidently states it will return a meaningful code. If this was a
"feature" then it would have to be consistent with the documentation, so
I'm putting it down as a bug (in the documentation or half the /etc/rc.d
scripts).
You make a good point that a jail (or any other service) might start and
then stop shortly afterwards by design. As this was ARM64 binaries, not
a single instruction was executed so I'd say that landed on the "failed"
side. But perhaps, as you suggest, it's not so easy to define total
success as a service can indeed start running and shut down due to an
error during initialisation and the script can't tell other than waiting
for, say, 15 seconds and checking it's still there.
For practical purposes, running "jls -j <jailname>" afterwards gives you
a valid success code if it has started - for anyone reading this in the
future and looking for an answer.
Regards, Frank.