Sending Signal to remote process

Philipp Marek philipp at marek.priv.at
Thu Jan 25 03:28:58 AEDT 2018


[resending to list]

> Depending on your exact use case, this might help:  Have an option to
> ssh that causes it to print the PID of the user process on the remote
> computer.
IIF you use session multiplexing, you can open another shell via the 
same SSH process and easily get the "other" child process (the sibling) 
via "pgrep -P $$": that asks for processes with the same parent PID.

Be careful to quote '$$' so that it's interpolated on the remote side 
only.


Even easier would be 'pkill -P $$', of course...


If you can't use session multiplexing, you might be able to find the 
interesting process via the other arguments to pgrep/pkill - like "-U", 
and/or specifying "-P $(pidof sshd)", etc.



More information about the openssh-unix-dev mailing list