여러개의 서버에 일괄 작업을 수행하고자 할때 아이피를 얻어오는 과정이 필요해 이렇게 남겨둡니다.

 

아이피 얻어오기

– eth1의 아이피를 얻어오기 위해 아래와 같이 sed를 이용 했다.

ifconfig eth1 | grep -v ‘inet6’ | sed -n “s,.*addr:\([^\s]*\) .*,\1,p”

192.168.0.2

 

 

– Shell 프로그래밍

http://wiki.kldp.org/Translations//html/Shell_Programming-KLDP/index.html

http://wiki.kldp.org/HOWTO/html/Adv-Bash-Scr-HOWTO/
http://blog.dasom.pe.kr/4
http://www.xmppro.net/zboard.php?id=unix

keepalived DR 구성

http://netggio.pe.kr/wiki/index.php/Keepalived/ipvs%EC%9D%84_%EC%9D%B4%EC%9A%A9%ED%95%9C_%EB%A6%AC%EB%88%85%EC%8A%A4_L4_-_DR(Direct_Routing)_%EA%B5%AC%EC%B6%95

 

우분투 bonding

http://helpboy.tistory.com/category/IT%EC%9D%B8%EC%83%9D_%EC%8A%A4%ED%81%AC%EB%9E%A9/Linux

#!/usr/bin/perl
$IP=”000.000.000.000″; // 이곳엔 사용하고자 하는 아이피를 넣어주세요
$HttpdConfFile = “/etc/httpd/conf/virtualhost.conf”;
$SendmailCW = “/etc/mail/local-host-names”;
$virtual = “/etc/mail/virtusertable”;

print “도메인을 입력해주세요.
“;
print “예) abc.co.kr.

“;
$t1 = <STDIN>;
print “FTP ID를 입력해주세요

“;
$t2 = <STDIN>;
chop $t1;
chop $t2;
if(finger $t2 2>/dev/null){
printf(“이미 존재하는 계정.

“);
exit
}
if($t2 eq “”||$t1 eq “”){
printf(“입력값이 올바르지 않습니다.

“);
exit
}

system(“/usr/sbin/adduser $t2 -d /home/$t1”);
system(“chmod 711 /home/$t1”);
print “Setup Complete!

“;
open (HANDLE,”>>$HttpdConfFile”);
print HANDLE ”
<VirtualHost $IP>
ServerAdmin $t2@$t1
DocumentRoot /home/$t1/public_html
Alias /cgi-bin/ /home/$t1/cgi-bin/
ServerName www.$t1
ServerAlias $t1
TransferLog /log/httpd/$t1-access_log
</VirtualHost>
“;
close (HANDLE);
open (HANDLE,”>>$virtual”);
print HANDLE “webmaster@$t1 $t2
“;
close (HANDLE);
open (HANDLE,”>>$SendmailCW”);
print HANDLE “$t1
“;
close (HANDLE);
system(“cp -f $virtual $virtual.bak”);
system(“/usr/sbin/makemap hash $virtual < $virtual”);
print “FTP 비밀번호를 입력해 주세요.
: “;
system(“passwd $t2”);
system(“service httpd restart”);
print “webmaster Mail Setup Complete!

“;
print “Your E-mail Address : webmaster@$t1