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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章