Sending Signal to remote process

Carlos Morel Gómez La Roque carlos at nodolibre.org
Wed Jan 24 14:56:13 AEDT 2018


Well, it would be nice to do

ssh remote print-signal.py

and then

ssh remote pkill print-signal.py

This should work for your way of
getting pid but beware when you
have two or more instances
that could be running and want
selective killing.

Instead a pkill calling and the use of pgrep
I like to write a pagre and peca like so

bin/pagre
#!/bin/bash
ps -A | grep $1

bin/peca
#!/bin/bash
pgrep $@ | cut -d" " -f2 | xargs kill -9

so you will have to do

ssh remote peca print-signal.py

cheers

carlos

El martes, 23 de enero de 2018, Thomas Güttler <guettliml at thomas-guettler.de>
escribió:

> I want ssh to forward the SIGTERM signal to the remote command.
>
>
> Example:
>    ssh root at localhost /root/print-signal.py
>
>
> Get PID of ssh:
>     ps aux| grep print-signal
>
>
> Kill the matching ssh process:
>     kill pid-of-ssh
>
>
> Unfortunately only the ssh process itself gets the signal, not the remote
> command (print-signal.py). The remote command does not terminate :-(
>
> How can I make ssh "forward" the SIGTERM signal to the remote command?
>
> See https://stackoverflow.com/questions/48377993/forwards-sigterm-over-ssh
>
> According to this[1] answer, openssh does not implement this.
>
> It would be realy great if openssh could forward the signal to the
> remote-command.
>
> What do you think?
>
> Regards,
>   Thomas Güttler
>
>
> [1] https://stackoverflow.com/questions/46333657/send-signals-to
> -remote-process-with-python/47581495#47581495
>
>
>
> --
> Thomas Guettler http://www.thomas-guettler.de/
> I am looking for feedback: https://github.com/guettli/pro
> gramming-guidelines
>
> _______________________________________________
> openssh-unix-dev mailing list
> openssh-unix-dev at mindrot.org
> https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
>


More information about the openssh-unix-dev mailing list