1

How can I check whether the nginx -s reload is success?

When I use the nginx -s reload to reload my nginx, there is no console in my terminal.

how can I check whether is success?

sof-03
  • 2,255
  • 4
  • 15
  • 33

1 Answers1

0

Use

nginx -s reload && echo "Success" || echo "Failure"

For a more complete explanation on the && and || usage, have a look at this post.

picnix_
  • 377
  • 2
  • 7
  • That will also output `Failure` if the reload succeeded, but `echo Success` failed for some reason. – melpomene May 12 '18 at 14:07
  • Well, then you can just remove the `||` part. However, if the `echo` fails, I would be more concerned about that ... – picnix_ May 12 '18 at 17:02