Expect Shell를 사용한 L4 Switch 자동 제외
Sycros URL 감시로 응답에러 발생시 , 해당 서버 파라미터에 Annotation을 실행 파일로 등록
하여 Shell 실행될수 있도록 합니다.
| app1_exclude_l4.sh 스크립트 내용: |
#!/bin/bash /opt/sycros/custom/expect/exclude_app1_l4.sh /opt/sycros/bin/scevent -h gwweb1 -s 3 -d "App1 서버가 L4Switch에서 제외 되었습니다" App_L4
| app1_exclude_l4에서 아래 스크립트 호출: |
#!/usr/bin/expect ## Filename: exclude_app1_l4.sh ## EMR App1 L4 Exclude ####### ## By Seo Euitae ############# set timestamp [timestamp -format %Y-%m-%d_%H:%M] set logfile /opt/sycros/custom/expect/log/App1_exec_$timestamp.log log_file -a $logfile set stty_init -onlcr spawn ssh -l user ipaddress expect "password:" send "실제 패스워드\r" expect -re "Last login:" send_user "\n# SSH is success \n" send -- "configure\r\n" send -- "slb EMR_APP_80\r\n" send -- "real 12 graceful-shutdown enable\r\n" send -- "apply\r\n" send "quit\r" expect eof