yoshinorim / mha4mysql-manager

Development tree of Master High Availability Manager and tools for MySQL (MHA), Manager part
http://code.google.com/p/mysql-master-ha/
GNU General Public License v2.0
1.46k stars 501 forks source link

report_script does not work because of options.. #58

Closed Cugar15 closed 8 years ago

Cugar15 commented 8 years ago

HI, I'm trying to get report_script to work with no luck.

1) There seems to be a conf argument passed - which is easy to workaround by adding.. 2) "Option new_slave_hosts requires an argument" How can this be sloved? 3) sh: 1: Syntax error: "(" unexpected Seems to be caused by ( in the body text...

Here is my code:

use strict; use warnings FATAL => 'all';

use Getopt::Long;

new_master_host and new_slave_hosts are set only when recovering master succeeded

my ( $dead_master_host, $new_master_host, $conf, $new_slave_hosts, $subject, $body, $email ); GetOptions( 'orig_master_host=s' => \$dead_master_host, 'new_master_host=s' => \$new_master_host, 'conf=s' => \$conf, 'new_slave_hosts=s' => \$new_slave_hosts, 'subject=s' => \$subject, 'body=s' => \$body, );

exit &main();

sub main {

$email="myemail\@domain.de";

system("echo ".$body." | mail -s ".$subject." ".$email );

}

Thanks for help! Appreciate it!

Cugar15 commented 8 years ago

OK, got ist solved. 1) remains, but again, this is easy to add 2) and 3) are solved by the correct email system command: system("echo '$body' | mail -s '$subject' '$email'" );