这个脚本老早之前完成的,还是在刚开始学perl的时候

lvs添加realserver的时候,一大堆的命令,记不住,索性写一脚本方便操作

后面的pringlog 以及usage函数是这样写的

sub printlog {
    my $messages = shift;
    open(SYSLOG,">>/var/log/messages") || die "$!\n";
    print SYSLOG "$messages";
    close SYSLOG;
}

sub usage {
    print <<EOT;
No arguments!
Usage: $0 <-add|-del> <ipadd> [weight]
Options
-add
    this options means you will add a host to lvs pool
-del
    this options means you will del a host from lvs pool
weight
    the weight for lvs host
EOT
}