0

I have a local script, and I need to start a service on a remote server.

Normally, if I was logged in on the remote server, I would use for example:

service rsyslog restart

and I would see following output:

enter image description here

But when I connect non-interactively from my script, ie

ssh myserver.com "service rsyslog restart"

I don't get the colorized [OK] output:

enter image description here

And when I add -t option to ssh, I do get the colorized output, but then also I get extra verbose info Connection to server closed. which i don't want because it interferes with my script:

enter image description here

How can I get colorized output without the extra verbose info?

1 Answer 1

1

If you also add on the -q(uiet) option, it will suppress the disconnect line and other information messages:

ssh -tq myserver.com "service rsyslog restart"
 -q      Quiet mode.  Causes most warning and diagnostic messages to be suppressed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .