How can I ssh to a server to kill parent and children process using partial process id name?
The following command line gives me the error pgrep: option requires an argument -- 'P'
<code>sudo -u USERID ssh -o StrictHostKeyChecking=no server_name PID=$(pgrep -o -fi pattern); CPIDS=$(pgrep -P ${PID}); kill -KILL $CPIDS; kill -TERM $CPIDS; kill -KILL $PID; kill -TERM $PID
</code>
<code>sudo -u USERID ssh -o StrictHostKeyChecking=no server_name PID=$(pgrep -o -fi pattern); CPIDS=$(pgrep -P ${PID}); kill -KILL $CPIDS; kill -TERM $CPIDS; kill -KILL $PID; kill -TERM $PID
</code>
sudo -u USERID ssh -o StrictHostKeyChecking=no server_name PID=$(pgrep -o -fi pattern); CPIDS=$(pgrep -P ${PID}); kill -KILL $CPIDS; kill -TERM $CPIDS; kill -KILL $PID; kill -TERM $PID
Thank you.