[CentOS] ssh remote execute awk problem
Les Mikesell
lesmikesell at gmail.com
Thu Mar 17 14:35:30 UTC 2011
On 3/17/2011 8:31 AM, Nico Kadel-Garcia wrote:
>
>> Quote the whole command and backslash the command quotes...
>> ssh root at localhost "awk '/processor/{count[\"proc\"]++}; END{print
>> count[\"proc\"] } ' /proc/cpuinfo"
>>
>> JD
>
> Or do the processing locally and stay away from proc nuttiness,
> without mucking with ssh and awk.
>
> grep ^processor /proc/cpuinfo | wc -l
>
> Or:
>
> ssh -l $TARGETUSER $TARGETHOST "[ -e /proc/cpuinfo ] -a grep
> ^processor | wc -l"
Or, more extremely - if you are doing much of this kind of remote
inventory checking, you might consider running ocsinventory-ng with
agents on the nodes.
--
Les Mikesell
lesmikesell at gmail.com
More information about the CentOS
mailing list