Linux Nohup


原文链接: Linux Nohup

server.conf

ajX 11.22.33.44
mnc 55.66.77.88

interval==${1:-1}
delay=${2:-1800}
b=Server-
c=1
d=-
a=$(date +%Y-%m-%d-%H-%M)
INDEX=0
while read NAMES[${INDEX}] IP[${INDEX}] PORT[${INDEX}]
do
  ((INDEX=$INDEX+1))
done < server.conf

for (( i=0,j=i+1; i<${INDEX}; i++,j++ ))
do
echo "Server $j Username : "${NAMES[i]}
echo "Server $j IP : "${IP[i]}
file=$b$c$d$a
echo "Server $j file name : "$file
nohup ssh ${NAMES[i]}@${IP[i]} -p${PORT[i]} "vmstat -n ${interval} ${delay} > $file.csv" >& /dev/null & #这里不要用单引号
let c++
done
`