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?
Enabling X11 Forwarding in your SSH Client To be certain it is enabled, you may use ssh -X. PuTTY: Prior to connection, in your connection's options, under "Tunnels", check "Enable X11 forwarding", and save your connection. MobaXterm: X11 is automatically enabled.
The SIGTERM signal is a generic signal used to cause program termination. Unlike SIGKILL , this signal can be blocked, handled, and ignored.
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 .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With