I have multiple hosts ( More than 20) and need to execute the command but it is not working as expected.
- This snippet of the code runs on multiple hosts and gives me the process id on the host where i am running .
for hsts in `cat /a/b/c//hsts.txt` # hsts.txt file contains all the hosts
do
ssh ${id}@${hsts} "cat /z/y/x|tail -1" | awk '{print $30}'
done
-
I need to modify the above command where i need to see the process which is running based on the process id which i am getting from above snippet of the code.
The below snippet runs on individual hosts and it is displaying me the process but if i incorporate the above in the for loop it is not working . Appreciate your help
on this.
ps -ef |grep `cat /z/y/x|tail -1 |awk '{print $30}'`