It seems that many
init.d scripts return 0 on failure, in spite of these recommendations. For example, in
nginx, running directly:
/usr/sbin/nginx -t # returns 1 (with a bad config)
and running via
service nginx configtest # returns 0 (with a bad config)
What's the best way of managing the missing status code? It seems there are a few options:
- Parse the output looking for 'fail' whenever you call the command.
- Update the
init.dscripts to honour the expected codes described here.
/lib/lsb/init-functionsso that it does the usual logging and then
exits with the exit code it is given initially.