Re: ssh remote execute awk problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 3/17/2011 8:31 AM, Nico Kadel-Garcia wrote:
>
>> Quote the whole command and backslash the command quotes...
>> ssh root@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@xxxxxxxxx
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux