#!/bin/bash
For i in ' cat/home/lee/hosts '
Do
Ssh-i/home/lee [email protected] $i "Free-m >/root/${i}_memory.txt;/bin/hostname >>/root/${i}_memory.txt"
Sleep 1
Scp-i/home/lee $i:/root/${i}_memory.txt/root/
Sleep 1
Done
if [!-f/root/get_memory.txt]
Then
Touch/root/get_memory.txt
Fi
Echo >/root/get_memory.txt
For j in ' LS 192* '
Do
Sed-n 3p $J | awk ' {print $4} ' >>/root/get_memory.txt
host= ' sed-n ' $p ' $j '
ipadd= ' ls $j '
echo "${ipadd%_*}-$host" >>/root/get_memory.txt
Done
Gzexe encryption
Note: The SSH key login execution command encountered a host always prompt for password, find a half-day finally found in the log inside said/root directory permissions have problems, it seems that if it is set up the password-free login, whether it is the key file itself or the permissions of the upper directory is very important.
This article is from the "Little v Yun Road" blog, make sure to keep this source http://victor2016.blog.51cto.com/6768693/1917410
A shell that gets memory information and a pit that it encounters