We've a scenario where I'm executing various remote commands at once like the following:
ssh user@remote-ip "
ps -A | grep java
rm -rf /usr/share/tomcat/webapps/ROOT
ls
"
The above set of commands runs properly on the remote server. But when I'm adding a pkill command in between then the commands after it does not executes:
ssh user@remote-ip "
ps -A | grep java
pkill -f tomcat
rm -rf /usr/share/tomcat/webapps/ROOT
ls
"
So, in the above case, the first two commands i.e. ps -A | grep java and pkill -f tomcat executes properly on the remote server and the rest of the two commands didn't.
Is there any special handling with pkill command?