How can I restart stunnel4 and suppress output unless there is an error?
I tried using the -quiet
flag, but according to the manpage that is NT/2000/XP only
$ /etc/init.d/stunnel4 restart -quiet
/etc/stunnel/-quiet.conf does not exist.
I've also tried using an output log, and lowered the debug from 5
(default, notice) to 4
(warning) within the config file.
output = /var/log/stunnel4/stunnel.log
debug = 4
[--truncated--]
No matter what I try it always prints the status:
$ /etc/init.d/stunnel4 restart
Restarting SSL tunnels: [stopped: /etc/stunnel/attnam.conf] [Started: /etc/stunnel/attnam.conf] stunnel.
The normal way to suppress output is to use output redirection e.g.
which sends stdout and stderr to the bitbucket. However you want stderr so remove the last redirection. This may not do exactly as you want as, the command itself may be using some sort of redirection or writing to different file descriptors, so it may be easier to wrap your command in a script and test it's exit value. You know the usual stuff.