linux: shell腳本日常功夫2

hadoop集羣管理腳本:

  1. diy-ssh.sh==> ssh免密登錄
  2. diy-syn.sh==> 同步節點配置文件
  3. diy-op.sh==> jps查看進程, 更新時間日期
  4. diy-kill.sh==> 殺死某進程,如 hmaster

part1: 免密登錄腳本

diy-ssh.sh

#!/bin/bash
#生成祕鑰,登錄localhost
if [ ! -d ~/.ssh ]
then 
    mkdir ~/.ssh 
fi
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
ssh-copy-id localhost

#登錄集羣
while [ $# != 0 ] 
do
    echo  "param=> $1 "
    ssh-copy-id $1
    shift
done
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章