10

I want ssh to forward the SIGTERM signal to the remote command.

ssh root@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?

5

2 Answers 2

1

I think you can do the following :

ssh root@localhost /root/print-signal.py

**Get PID of python file running **

ps aux| grep print-signal

Kill the matching ssh process:

ssh root@localhost "kill <pid>"

Here you are sending command to remote host .

Hope this solves your problem .

0

Send via SSH this (tested on sleep process):

$(proc=$(pidof sleep) && kill $proc)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.