If I execute below code I am able to get string from column8 and column10 about a process.
servers
But when I try to execute below script to execute same command on multiple servers, I am getting "0"s instead of column8 and column10. I think block of lines execution syntax does not like --> $8" "$10 in awk.
How can I print output from each server in this format?
Code:
serverA1$> ps -ef | grep rotate | grep 'config' | awk '{print $8" "$10}'
/<Oracle_home>/ohs/bin/odl_rotatelogs -h:/<app_Home>/config/OHS/ohs1/component_events.xml_ohs1
/<Oracle_home>/ohs/bin/odl_rotatelogs -h:/<app_Home>/config/OHS/ohs1/component_events.xml_ohs2
/<Oracle_home>/ohs/bin/odl_rotatelogs -h:/<app_Home>/config/OHS/ohs1/component_events.xml_ohs3
servers
Code:
serverA1
serverB1
serverC1
Code:
#!/bin/bash
for server in `cat servers` ; do
sudo ssh $server "bash -s" << EOF
echo "server=$server"
ps -ef | grep rotate | grep 'config' | awk '{print $8" "$10}'
EOF
done
Code:
--> $server, $column8, $column10
Moderator's Comments: | ||
|