0

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.
andrewtweber
  • 449
  • 1
  • 10
  • 18

1 Answers1

2

The normal way to suppress output is to use output redirection e.g.

 /etc/init.d/stunnel4 restart >/dev/null 2>&1

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.

user9517
  • 114,104
  • 20
  • 206
  • 289