首页 > 代码库 > 一个有用的shell脚本
一个有用的shell脚本
#!/bin/bash#if [ $1 -eq null ]; then # echo "please input params1!"# exit#fi#if [ $2 -eq null ]; then # echo "please input params2!"# exit#fi# type , $1 { scp, ssh }, src $2, dst $3user=hadoopif [ "$3" != "" -a "$1" != "scp" ] ; then user=$3fiif [ "$4" != "" ] ; then iplist=$4else iplist=`cat /home/hadoop/gitclone/opshell/hadoop/machine.conf` fifor ip in $iplist;do echo "-----ops $ip -------------" if [ "$1" == "scp" ] ; then scp -r $2 $user@$ip:$3 elif [ "$1" == "ssh" ] ; then ssh $user@$ip "mkdir ~/.ssh | touch ~/.ssh/authorized_keys" cat ~/.ssh/id_rsa.pub | ssh $user@$ip "cat >> ~/.ssh/authorized_keys" ssh $user@$ip "chmod 700 ~/.ssh" elif [ "$1" == "cmd" ] ; then ssh $user@$ip "$2" fidone
一个有用的shell脚本
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。