批量重命名,把关键词放在前面,动作词放在后面
This commit is contained in:
102
expect-ssh2server.sh
Executable file
102
expect-ssh2server.sh
Executable file
@@ -0,0 +1,102 @@
|
||||
local=killer-sDeb10-vMac.local
|
||||
us1=us-nj-1.faronear.net
|
||||
us2=us-nj-2.faronear.net
|
||||
de1=de-1.faronear.net
|
||||
de2=de-2.faronear.net
|
||||
de3=de-3-arm.faronear.net
|
||||
de4=de-4-arm.faronear.net
|
||||
sh=cn-sh.faronear.net
|
||||
wx=cn-wx.farinear.cn
|
||||
|
||||
if [ $1 ]
|
||||
then
|
||||
TARGET=$1
|
||||
else
|
||||
echo Connect to
|
||||
echo " local : $local"
|
||||
echo " us1 : $us1"
|
||||
echo " us2 : $us2"
|
||||
echo " de1 : $de1"
|
||||
echo " de2 : $de2"
|
||||
echo " de3 : $de3"
|
||||
echo " de4 : $de4"
|
||||
echo " sh : $sh"
|
||||
echo " wx : $wx"
|
||||
echo " other : specify host/user/pwd"
|
||||
echo
|
||||
read -p "Enter target (default to other)>> " TARGET
|
||||
if [ ! $TARGET ]
|
||||
then
|
||||
TARGET=other
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $TARGET = "local" ]
|
||||
then
|
||||
read -p "Enter adot password (ROAD) >>" PWD_ADOT
|
||||
read -p "Enter root password (YU) >>" PWD_ROOT
|
||||
expect ~/faronear/fon/sysconfig/expect-ssh.sh $local adot $PWD_ADOT $PWD_ADOT
|
||||
elif [ $TARGET = 'us1' ]
|
||||
then
|
||||
read -p "Enter adot password (ROAD) >>" PWD_ADOT
|
||||
read -p "Enter root password (YU) >>" PWD_ROOT
|
||||
expect ~/faronear/fon/sysconfig/expect-ssh.sh $us1 adot $PWD_ADOT $PWD_ROOT
|
||||
elif [ $TARGET = 'us2' ]
|
||||
then
|
||||
read -p "Enter adot password (ROAD) >>" PWD_ADOT
|
||||
read -p "Enter root password (YU) >>" PWD_ROOT
|
||||
expect ~/faronear/fon/sysconfig/expect-ssh.sh $us2 adot $PWD_ADOT $PWD_ROOT
|
||||
elif [ $TARGET = 'de1' ]
|
||||
then
|
||||
read -p "Enter adot password (ROAD) >>" PWD_ADOT
|
||||
read -p "Enter root password (YU) >>" PWD_ROOT
|
||||
expect ~/faronear/fon/sysconfig/expect-ssh.sh $de1 adot $PWD_ADOT $PWD_ROOT
|
||||
elif [ $TARGET = 'de2' ]
|
||||
then
|
||||
read -p "Enter adot password (ROAD) >>" PWD_ADOT
|
||||
read -p "Enter root password (YU) >>" PWD_ROOT
|
||||
expect ~/faronear/fon/sysconfig/expect-ssh.sh $de2 adot $PWD_ADOT $PWD_ROOT
|
||||
elif [ $TARGET = 'de3' ]
|
||||
then
|
||||
read -p "Enter adot password (ROAD) >>" PWD_ADOT
|
||||
read -p "Enter root password (YU) >>" PWD_ROOT
|
||||
expect ~/faronear/fon/sysconfig/expect-ssh.sh $de3 adot $PWD_ADOT $PWD_ROOT
|
||||
elif [ $TARGET = 'de4' ]
|
||||
then
|
||||
read -p "Enter adot password (ROAD) >>" PWD_ADOT
|
||||
read -p "Enter root password (YU) >>" PWD_ROOT
|
||||
expect ~/faronear/fon/sysconfig/expect-ssh.sh $de4 adot $PWD_ADOT $PWD_ROOT
|
||||
elif [ $TARGET = 'sh' ]
|
||||
then
|
||||
read -p "Enter adot password (ROAD) >>" PWD_ADOT
|
||||
read -p "Enter root password (YU) >>" PWD_ROOT
|
||||
expect ~/faronear/fon/sysconfig/expect-ssh.sh $sh adot $PWD_ADOT $PWD_ROOT
|
||||
elif [ $TARGET = 'wx' ]
|
||||
then
|
||||
read -p "Enter adot password (ROAD) >>" PWD_ADOT
|
||||
read -p "Enter root password (YU) >>" PWD_ROOT
|
||||
expect ~/faronear/fon/sysconfig/expect-ssh.sh $wx adot $PWD_ADOT $PWD_ROOT
|
||||
else
|
||||
echo Other target is selected. Please specify details of the target:
|
||||
while [ ! $HOST ]
|
||||
do
|
||||
read -p "host = " HOST
|
||||
done
|
||||
|
||||
while [ ! $USER ]
|
||||
do
|
||||
read -p "user = " USER
|
||||
done
|
||||
|
||||
while [ ! $PWD_USER ]
|
||||
do
|
||||
read -p "user password = " PWD_USER
|
||||
done
|
||||
|
||||
while [ ! $PWD_SU ]
|
||||
do
|
||||
read -p "root password = " ROOT_SU
|
||||
done
|
||||
|
||||
expect ~/faronear/fon/sysconfig/expect-ssh.sh $HOST $USER $PWD_USER $PWD_SU
|
||||
fi
|
||||
Reference in New Issue
Block a user