shell加LDAP实现跳板机
发布时间:2016-11-01 02:35:54 所属栏目:Linux 来源:网络整理
导读:使用跳板机的目的:我们的服务器都是云主机,使用的都是aws比较多,而且aws是以私钥去连接公钥,连接的方式都是以root权限连接,这样子的话,开发人员要连接上
|
脚本如下:
[root@localhost jc]# cat tiaoban_deploy.sh
#!/bin/bash
ip=`/sbin/ifconfig eth0|grep "inet addr"|awk -F ":" '{print $2}'|awk '{print $1}'`
current_date=`date +%Y-%m-%d-%H:%M:%S`
dis_manumenu="<ip:${ip}-server>"
user=`echo $USER`
# Source function library.
. /etc/rc.d/init.d/functions
new_echo () {
if [ -z "$2" ]
then
COLOR=33
elif [ $2 == red ]
then
COLOR=31
elif [ $2 == green ]
then
COLOR=32
elif [ $2 == blue ]
then
COLOR=36
elif [ $2 == purple ]
then
COLOR=35
elif [ $2 == white ]
then
COLOR=39
else
echo new_echo function use error
exit
fi
if [ -z "$4" ]
then
COLOR1=33
elif [ $4 == red ]
then
COLOR1=31
elif [ $4 == green ]
then
COLOR1=32
elif [ $4 == blue ]
then
COLOR1=36
elif [ $4 == purple ]
then
COLOR1=35
elif [ $4 == white ]
then
COLOR1=39
else
echo new_echo function use error
exit
fi
if [ -z "$3" ]
then
echo -en " |
