#!/bin/bash


### global variables ###


date=`date +%Y%m%d`


### 서버 리스트 

api='/root/shell/admin/serverlist/api_server_list'

en='/root/shell/admin/serverlist/en_server_list'

upload='/root/shell/admin/serverlist/upload_server_list'

test='/root/shell/admin/serverlist/test_server_list'


server_file="$1"

commend="$2"


### start funcion ### 


# 기본적으로 보여주는 메뉴

notice () {

clear

cat << __EOF__

[2014-09-26 TH] Server sctipts Update shell 

Notice : $0 [ api | en | upload | -> coming soon ...add server] updata_file

Not Exec scritps

__EOF__

}



ssh_exec () {


cat /root/shell/admin/serverlist/$server_file\_server_list | awk '{print $1}' > /root/shell/admin/serverlist/$server_file\_server_list_tmp

for i in `cat /root/shell/admin/serverlist/"$server_file"_server_list_tmp`;

do

ssh $i "$commend"

echo "ssh $i exec start"


done

}


### Main ###


echo "$0 $1 $2"


# start update shell scripts 

case "$1" in

        api)

                ssh_exec

                ;;

        en)

                ssh_exec

                ;;

        upload)

                ssh_exec

                ;;

        test)

                ssh_exec

                ;;

        *)

                notice

                exit

esac




#### 스크립트의 구성

# 서버 리스트를 미리 작성 서버IP를 특정 파일에 나열, 서버 기능별로 나열

# 위의 스크립트는 단순 명령어만 가능하다, uptime 등의 인자값 없는 명령어만 가능 

# 앞으로 기능 추가가 필요하다


### Last Version 20141021 TH ###

'IT Study > script' 카테고리의 다른 글

nfs를 이용한 간단한 백업 스크립트  (0) 2016.02.19
tomcat 프로세스 재구동 스크립트  (0) 2016.02.19
check storage  (0) 2016.02.19
서버 스크립트 자동 배포  (0) 2014.10.21
perl ssh 원격 명령 스크립트  (0) 2014.10.21

+ Recent posts