make ssh -qO {stop,exit} less noisy

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

make ssh -qO {stop,exit} less noisy

Tim Kuijsten-3
Hi tech@

This makes the tear down of ssh control masters better play with shell
scripts that are run by cron. If nothing unexpected happens and in quiet
mode, then don't echo back the command that is being requested.

-Tim


Index: mux.c
===================================================================
RCS file: /cvs/src/usr.bin/ssh/mux.c,v
retrieving revision 1.62
diff -u -p -r1.62 mux.c
--- mux.c       30 Sep 2016 09:19:13 -0000      1.62
+++ mux.c       16 Oct 2016 18:18:53 -0000
@@ -2212,7 +2212,8 @@ muxclient(const char *path)
                 exit(0);
         case SSHMUX_COMMAND_TERMINATE:
                 mux_client_request_terminate(sock);
-               fprintf(stderr, "Exit request sent.\r\n");
+               if (options.log_level != SYSLOG_LEVEL_QUIET)
+                       fprintf(stderr, "Exit request sent.\r\n");
                 exit(0);
         case SSHMUX_COMMAND_FORWARD:
                 if (mux_client_forwards(sock, 0) != 0)
@@ -2230,7 +2231,8 @@ muxclient(const char *path)
                 exit(0);
         case SSHMUX_COMMAND_STOP:
                 mux_client_request_stop_listening(sock);
-               fprintf(stderr, "Stop listening request sent.\r\n");
+               if (options.log_level != SYSLOG_LEVEL_QUIET)
+                       fprintf(stderr, "Stop listening request sent.\r\n");
                 exit(0);
         case SSHMUX_COMMAND_CANCEL_FWD:
                 if (mux_client_forwards(sock, 1) != 0)

Reply | Threaded
Open this post in threaded view
|

Re: make ssh -qO {stop,exit} less noisy

Darren Tucker
patch applied, thanks.

On Sun, Oct 16, 2016 at 11:20 AM, Tim Kuijsten <[hidden email]> wrote:

> Hi tech@
>
> This makes the tear down of ssh control masters better play with shell
> scripts that are run by cron. If nothing unexpected happens and in quiet
> mode, then don't echo back the command that is being requested.
>
> -Tim
>
>
> Index: mux.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/ssh/mux.c,v
> retrieving revision 1.62
> diff -u -p -r1.62 mux.c
> --- mux.c       30 Sep 2016 09:19:13 -0000      1.62
> +++ mux.c       16 Oct 2016 18:18:53 -0000
> @@ -2212,7 +2212,8 @@ muxclient(const char *path)
>                 exit(0);
>         case SSHMUX_COMMAND_TERMINATE:
>                 mux_client_request_terminate(sock);
> -               fprintf(stderr, "Exit request sent.\r\n");
> +               if (options.log_level != SYSLOG_LEVEL_QUIET)
> +                       fprintf(stderr, "Exit request sent.\r\n");
>                 exit(0);
>         case SSHMUX_COMMAND_FORWARD:
>                 if (mux_client_forwards(sock, 0) != 0)
> @@ -2230,7 +2231,8 @@ muxclient(const char *path)
>                 exit(0);
>         case SSHMUX_COMMAND_STOP:
>                 mux_client_request_stop_listening(sock);
> -               fprintf(stderr, "Stop listening request sent.\r\n");
> +               if (options.log_level != SYSLOG_LEVEL_QUIET)
> +                       fprintf(stderr, "Stop listening request sent.\r\n");
>                 exit(0);
>         case SSHMUX_COMMAND_CANCEL_FWD:
>                 if (mux_client_forwards(sock, 1) != 0)
>



--
Darren Tucker (dtucker at zip.com.au)
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860  37F4 9357 ECEF 11EA A6FA (new)
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.