ÿØÿà JFIF    ÿÛ „  ( %"1!%)+...383,7(-.+  -+++--++++---+-+-----+---------------+---+-++7-----ÿÀ  ß â" ÿÄ     ÿÄ H    !1AQaq"‘¡2B±ÁÑð#R“Ò Tbr‚²á3csƒ’ÂñDS¢³$CÿÄ   ÿÄ %  !1AQa"23‘ÿÚ   ? ôÿ ¨pŸªáÿ —åYõõ\?àÒü©ŠÄï¨pŸªáÿ —åYõõ\?àÓü©ŠÄá 0Ÿªáÿ Ÿå[úƒ ú®ði~TÁbqÐ8OÕpÿ ƒOò¤Oè`–RÂáœá™êi€ßÉ< FtŸI“öÌ8úDf´°å}“¾œ6  öFá°y¥jñÇh†ˆ¢ã/ÃÐ:ªcÈ "Y¡ðÑl>ÿ ”ÏËte:qž\oäŠe÷󲍷˜HT4&ÿ ÓÐü6ö®¿øþßèô Ÿ•7Ñi’•j|“ñì>b…þS?*Óôÿ ÓÐü*h¥£ír¶ü UãS炟[AÐaè[ûª•õ&õj?†Éö+EzP—WeÒírJFt ‘BŒ†Ï‡%#tE Øz ¥OÛ«!1›üä±Í™%ºÍãö]°î(–:@<‹ŒÊö×òÆt¦ãº+‡¦%ÌÁ²h´OƒJŒtMÜ>ÀÜÊw3Y´•牋4ǍýʏTì>œú=Íwhyë,¾Ôò×õ¿ßÊa»«þˆѪQ|%6ž™A õ%:øj<>É—ÿ Å_ˆCbõ¥š±ý¯Ýƒï…¶|RëócÍf溪“t.СøTÿ *Ä¿-{†çàczůŽ_–^XþŒ±miB[X±d 1,é”zEù»& î9gœf™9Ð'.;—™i}!ôšåîqêÛ٤ёý£½ÆA–àôe"A$˝Úsäÿ ÷Û #°xŸëí(l »ý3—¥5m! rt`†0~'j2(]S¦¦kv,ÚÇ l¦øJA£Šƒ J3E8ÙiŽ:cÉžúeZ°€¯\®kÖ(79«Ž:¯X”¾³Š&¡* ….‰Ž(ÜíŸ2¥ª‡×Hi²TF¤ò[¨íÈRëÉ䢍mgÑ.Ÿ<öäS0í„ǹÁU´f#Vß;Õ–…P@3ío<ä-±»Ž.L|kªÀê›fÂ6@»eu‚|ÓaÞÆŸ…¨ááå>åŠ?cKü6ùTÍÆ”†sĤÚ;H2RÚ†õ\Ö·Ÿn'¾ ñ#ºI¤Å´%çÁ­‚â7›‹qT3Iï¨ÖÚ5I7Ë!ÅOóŸ¶øÝñØôת¦$Tcö‘[«Ö³šÒ';Aþ ¸èíg A2Z"i¸vdÄ÷.iõ®§)¿]¤À†–‡É&ä{V¶iŽ”.Ó×Õÿ û?h¬Mt–íª[ÿ Ñÿ ÌV(í}=ibÔ¡›¥¢±b Lô¥‡piη_Z<‡z§èŒ)iÖwiÇ 2hÙ3·=’d÷8éŽ1¦¸c¤µ€7›7Ø ð\á)} ¹fËí›pAÃL%âc2 í§æQz¿;T8sæ°qø)QFMð‰XŒÂ±N¢aF¨…8¯!U  Z©RÊ ÖPVÄÀÍin™Ì-GˆªÅËŠ›•zË}º±ŽÍFò¹}Uw×#ä5B¤{î}Ð<ÙD é©¤&‡ïDbàÁôMÁ." ¤‡ú*õ'VŽ|¼´Úgllº¼klz[Æüï÷Aób‡Eÿ dÑ»Xx9ÃÜ£ÁT/`¼¸vI±Ýµ·Ë‚“G³þ*Ÿû´r|*}<¨îºœ @¦mÄ’M¹”.œ«Y–|6ÏU¤jç¥ÕÞqO ˜kDÆÁ¨5ÿ š;ÐЦ¦€GÙk \ –Þ=â¼=SͧµªS°ÚÍpÜãQűÀõ¬?ÃÁ1Ñ•õZà?hóœ€ L¦l{Y*K˜Ù›zc˜–ˆâ ø+¾ ­-Ök¥%ùEÜA'}ˆ><ÊIè“bpÍ/qÞâvoX€w,\úªò6Z[XdÒæ­@Ö—€$òJí#é>'°Ú ôª˜<)4ryÙ£|óAÅn5žêŸyÒäMÝ2{"}‰–¤l÷ûWX\l¾Á¸góÉOÔ /óñB¤f¸çñ[.P˜ZsÊË*ßT܈§QN¢’¡¨§V¼(Üù*eÕ“”5T¨‹Âê¥FŒã½Dü[8'Ò¥a…Ú¶k7a *•›¼'Ò·\8¨ª\@\õ¢¦íq+DÙrmÎ…_ªæ»ŠÓœ¡¯’Ré9MÅ×D™lælffc+ŒÑ,ý™ÿ ¯þǤ=Å’Á7µ÷ÚÛ/“Ü€ñýã¼àí¾ÕÑ+ƒ,uµMâÀÄbm:ÒÎPæ{˜Gz[ƒ¯«® KHà`ߨŠéí¯P8Aq.C‰ à€kòpj´kN¶qô€…Õ,ÜNŠª-­{Zö’æû44‰sŽè‰îVíRœÕm" 6?³D9¡ÇTíÅꋇ`4«¸ÝÁô ï’ýorqКÇZ«x4Žâéþuïf¹µö[P ,Q£éaX±`PÉÍZ ¸äYúg üAx ’6Lê‚xÝÓ*äQ  Ï’¨hÍ =²,6ï#rÃ<¯–£»ƒ‹,–ê•€ aÛsñ'%Æ"®ÛüìBᝠHÚ3ß°©$“XnœÖ’î2ËTeûìxîß ¦å¿çÉ ðK§þ{‘t‚Ϋ¬jéîZ[ ”š7L¥4VÚCE×]m¤Øy”ä4-dz£œ§¸x.*ãÊÊ b÷•h:©‡¦s`BTÁRû¾g⻩‹jø sF¢àJøFl‘È•Xᓁà~*j¯ +(ÚÕ6-£¯÷GŠØy‚<Ç’.F‹Hœw(+)ÜÜâÈzÄäT§FߘãÏ;DmVœ3Àu@mÚüXÝü•3B¨òÌÁÛ<·ÃÜ z,Ì@õÅ·d2]ü8s÷IôÞ¯^Ç9¢u„~ëAŸï4«M? K]­ÅàPl@s_ p:°¬ZR”´›JC[CS.h‹ƒïËœ«Æ]–÷ó‚wR×k7X‰k›‘´ù¦=¡«‰¨¨Â')—71ó’c‡Ðúµ `é.{§p¹ój\Ž{1h{o±Ý=áUÊïGÖŒõ–-BÄm+AZX¶¡ ïHðæ¥JmÙ;…䡟ˆ¦ ° äšiÉg«$üMk5¤L“’çÊvïâï ,=f“"íἊ5ô¬x6{ɏžID0e¸vçmi'︧ºð9$ò¹÷*£’9ÿ ²TÔ…×>JV¥}Œ}$p[bÔ®*[jzS*8 ”·T›Í–ñUîƒwo$áè=LT™ç—~ô·¤ÈÚ$榍q‰„+´kFm)ž‹©i–ËqÞŠ‰à¶ü( ‚•§ •°ò·‡#5ª•µÊ﯅¡X¨šÁ*F#TXJÊ ušJVÍ&=iÄs1‚3•'fý§5Ñ<=[íÞ­ PÚ;ѱÌ_~Ä££8rÞ ²w;’hDT°>ÈG¬8Á²ÚzŽ®ò®qZcqJêäÞ-ö[ܘbň±çb“ж31²n×iƒðÕ;1¶þÉ ªX‰,ßqÏ$>•î íZ¥Z 1{ç൵+ƒÕµ¥°T$§K]á»Ûï*·¤tMI’ÂZbŽÕiÒ˜}bÓ0£ª5›¨ [5Ž^ÝœWøÂÝh° ¢OWun£¤5 a2Z.G2³YL]jåtì”ä ÁÓ‘%"©<Ôúʰsº UZvä‡ÄiÆÒM .÷V·™ø#kèýiíÌ–ª)µT[)BˆõÑ xB¾B€ÖT¨.¥~ð@VĶr#¸ü*åZNDŽH;âi ],©£öØpù(šºãö¼T.uCê•4@ÿ GÕÛ)Cx›®0ø#:ÏðFÒbR\(€€Ä®fã4Þ‰Fä¯HXƒÅ,†öEÑÔÜ]Öv²?tLÃvBY£ú6Êu5ÅAQ³1‘’¬x–HŒÐ‡ ^ ¸KwJôÖŽ5×CÚ¨vÜ«/B0$×k°=ðbÇ(Ï)w±A†Á† 11Í=èQšµ626ŒÜ/`G«µ<}—-Ö7KEHÈÉðóȤmݱû±·ø«Snmá=“䫚mݱŸ¡¶~ó·“äUóJæúòB|E LêŽy´jDÔ$G¢þÐñ7óR8ýÒ…Ç› WVe#·Ÿ p·Fx~•ݤF÷0Èÿ K¯æS<6’¡WШ; ´ÿ ¥Êø\Òuî†åÝ–VNœkÒ7oòX¨Á­Ø÷FÎÑä±g÷ÿ M~Çî=p,X´ ÝÌÚÅ‹’ÃjÖ.ØöÏñ qïQ¤ÓZE†° =6·]܈ s¸>v•Ž^Ý\wq9r‰Î\¸¡kURÒ$­*‹Nq?Þª*!sŠÆ:TU_u±T+øX¡ ®¹¡,ÄâÃBTsÜ$Ø›4m椴zÜK]’’›Pƒ @€#â˜`é¹=I‡fiV•Ôî“nRm+µFPOhÍ0B£ €+¬5c v•:P'ÒyÎ ‰V~‚Ó†ÖuókDoh$å\*ö%Ю=£«…aȼ½÷Û.-½VŒŠ¼'lyî±1¬3ó#ÞE¿ÔS¤gV£m›=§\û"—WU¤ÚǼÿ ÂnÁGŒÃ ‚õN D³õNÚíŒÕ;HôyÄÈ©P¹Ä{:?R‘Ô¨âF÷ø£bÅó® JS|‚R÷ivýáâ€Æé¡è³´IئÑT!§˜•ت‚¬â@q€wnïCWÄ@JU€ê¯m6]Ï:£âx'+ÒðXvÓ¦Úm=–´7œ $ì“B£~p%ÕŸUþ« N@¼üï~w˜ñø5®—'Ôe»¤5ã//€ž~‰Tþ›Å7•#¤× Íö pÄ$ùeåì*«ÓŠEØWEÈsßg ¦ûvžSsLpºÊW–âµEWöˬH; ™!CYõZ ÃÄf æ#1W. \uWâ\,\Çf j’<qTbên›Î[vxx£ë 'ö¨1›˜ÀM¼Pÿ H)ƒêêŒA7s,|F“ 꺸k³9Ìö*ç®;Ö!Ö$Eiž•¹ÒÚ†ýóéÝû¾ÕS®ó$’NÝäŸz¤5r¦ãÄÃD÷Üø!°ø‡Ô&@m™Ì^Ãä­d q5Lnÿ N;.6½·N|#ä"1Nƒx“ã<3('&ñßt  ~ªu”1Tb㫨9ê–›–bìd$ߣ=#ÕãÒmU¯eí$EFù5ýYô櫨æì™Ç—±ssM]·á¿0ÕåJRÓªîiƒ+O58ÖñªŠÒx" \µâá¨i’¤i —Ö ” M+M¤ë9‚‰A¦°Qõ¾ßøK~¼Ã‘g…Ö´~÷Ï[3GUœÒ½#…kàÔ®Ò”‰³·dWV‰IP‰Ú8u¹”E ÖqLj¾êÕCBš{A^Âß;–¨`¯¬ìö ˼ ×tìø.tƐm*n¨y4o&Àx¥n¦×î‡aupáÛj8¿m›è¶ã!o½;ß0y^ý×^EÑ¿ÒjzŒ­)vÚÑnÄL …^ªô× ‡—‚3k Îý­hï]içå–îÏ*÷ñþ»Ô CÒjøjÍznˆ´ ¹#b'Fô‹ ‰v¥'’à'T´ƒHýÍ%M‰ ƒ&ÆÇŒï1 ‘ –Þ ‰i¬s žR-Ÿ kЬá¬7:þ 0ŒÅÒÕ/aÙ¬ÃÝ#Úøœ ©aiVc‰. ¹¦ãµ” ›Yg¦›ÆÎýº°f³7ƒhá·¸­}&D9¡ÂsÉÙÞèŠõØàC™¨ñbFC|´Ü(ŸƒÚÒ-%»'a Ì¿)ËÇn¿úÿ ÞŽX…4ÊÅH^ôΑí@ù¹Eh¶“L8Çjù ¼ÎåVªóR©Ï5uà V4lZß®=€xÖŸ–ÑÈ ÷”¨°¾__yM1tÉ?uÆþIkÄgæ@þ[¢†°XÃJ£j·:nkÅ¢u ‘}âGzö­/IµèЬ¼48q¦F°ŽR¼=ûì{´¯RýicS ÕÛ íNtÍÙï£,w4rêì®»~x(©Uñ§#Ñ&œÕ¤>ÎåÍÓ9’Ö{9eV­[Öjâ²ãu]˜å2›qÑšÕJç0€sÄ|Êëè0튔bÁ>“{×_F`Ø©ºê:µä,v¤ðfc1±"«ÔÍän1#=· Âøv~H½ÐßA¾¿Ü€Óš]Õ; I¾÷ç‚Qi†î¹9ywÔKG˜áñ zQY—§ÃÕZ07§X‚ Áh;ÁM)iÌCH-¯T‘ë|A0{Ò½LÚ–TâÖkÜ’dÀ“rmm»”جPF³ÖcbE§T€ÒxKºû’Ó®7±²(\4ŽÃ¸Uu@j™yĵ;³µ!Á¢b.W¤=mõ´êµK k ¸K^ÜÛ#p*Ü14qkZç5ïë †°5Ï%ÍÛ<Õ¤×Ô¥ê†C Õ´¼ú$ƒÖ“”]Ù¬qÞÚ[4©ý!ûÏ—Áb쳐XµA¬â~`›Çr¸8ìùÝ䫦<>ä÷«?xs´ÇÑ /á;¹øüÊÈÙà{"@Žïzâ¬[âß‚ U_<ÇŸ½4èN˜ú61®qŠu ¦þF£»äJ_ˆÙÎ~ ÞAã–݄ϗrŠD;xTž‘ô`É«…suãO`?³à™ô Lý#Íc5öoæØ‚y´´÷«ZR§<&JÇ+éâô´€i!Àˆ0æAoàðLèÖ-2ŸõW.’t^–(KÁmHµV@xÜÇy®Ñø­â^:Ú3w· 7½¹°ñ¸â¹®:',«Mœ—n­Á+Ãbš LÈ‘ÄnRÓÅœ%¦²‰¨ùQ:¤f‚ "PÕtô¸…cæl…&˜Ú˜Ôkv‹ž+vŠ,=¢v­6—Xy*¥t£«<™:“aîϲ=¦6rO]XI¿Œ÷¤zÚ­›¶ 6÷”w\d ü~v®ˆÌk«^m<ÿ ¢‰Õ\)ùºŽ;… lîÙÅEŠ®cѾ@vnMÏ,¼“ñ•ŽBxðÃzãÇç%3ˆ"}Ù•Åî> BÉú;Ò]V+P˜F_´ßé> Øše|ï‡ÄOmFæÇ ãqÞ$/xÐx­z`ï9"œÜij‚!7.\Td…9M‡•iŽ‹¾‘50ÞŽn¥ß4ÉôO ¹*í^QêËÜÇÌ8=ާs‰'ÂëÙ«á%Pú[O †ÅP¯Vsް.‰,kc¶ ¬A9n˜XÎ-ÞšN["¹QÕ‰ƒMýÁߺXJæÍaLj¾×Ãmã¾ãÚ uñÒþåQô¦¥ /ÄUx:‚ÍÜ’ Đ©ØÝ3V¨‰ÕnÐ6ó*óúK­«…c ¯U òhsý­jóÔj#,ímŒRµ«lbïUTŒÑ8†Ä0œÏr`ð¡¬É Ї ë"À² ™ 6¥ f¶ ¢ÚoܱԷ-<Àî)†a¶ž'Ú»¨TXqØæ¶÷YÄHy˜9ÈIW­YÀuMFë ºÏ’AqÌ4·/Ú †ô'i$øä­=Ä Ý|öK×40è|È6p‘0§)o¥ctî§H+CA-“ xØ|ÐXАç l8íºð3Ø:³¤¬KX¯UÿÙ #!/usr/bin/perl # Copyright (c) 2000, 2024, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, # as published by the Free Software Foundation. # # This program is designed to work with certain software (including # but not limited to OpenSSL) that is licensed under separate terms, # as designated in a particular file or component or in included license # documentation. The authors of MySQL hereby grant you an additional # permission to link the program and your derivative works with the # separately licensed software that they have either included with # the program or referenced in the documentation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License, version 2.0, for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA use Getopt::Long; use POSIX qw(strftime getcwd); use File::Path qw(mkpath); $|=1; $VER="2.16"; my @defaults_options; # Leading --no-defaults, --defaults-file, etc. $opt_example = 0; $opt_help = 0; $opt_log = undef(); $opt_mysqladmin = "/usr/bin/mysqladmin"; $opt_mysqld = "/usr/sbin/mysqld"; $opt_no_log = 0; $opt_password = undef(); $opt_tcp_ip = 0; $opt_user = "root"; $opt_version = 0; $opt_silent = 0; $opt_verbose = 0; my $my_print_defaults_exists= 1; my $logdir= undef(); my ($mysqld, $mysqladmin, $groupids, $homedir, $my_progname); $homedir = $ENV{HOME}; $my_progname = $0; $my_progname =~ s/.*[\/]//; if (defined($ENV{UMASK})) { my $UMASK = $ENV{UMASK}; my $m; my $fmode = "0640"; if(($UMASK =~ m/[^0246]/) || ($UMASK =~ m/^[^0]/) || (length($UMASK) != 4)) { printf("UMASK must be a 3-digit mode with an additional leading 0 to indicate octal.\n"); printf("The first digit will be corrected to 6, the others may be 0, 2, 4, or 6.\n"); } else { $fmode= substr $UMASK, 2, 2; $fmode= "06${fmode}"; } if($fmode != $UMASK) { printf("UMASK corrected from $UMASK to $fmode ...\n"); } $fmode= oct($fmode); umask($fmode); } main(); #### #### main sub routine #### sub main { my $flag_exit= 0; if (!defined(my_which(my_print_defaults))) { # We can't throw out yet, since --version, --help, or --example may # have been given print "WARNING: my_print_defaults command not found.\n"; print "Please make sure you have this command available and\n"; print "in your path. The command is available from the latest\n"; print "MySQL distribution.\n"; $my_print_defaults_exists= 0; } # Remove leading defaults options from @ARGV while (@ARGV > 0) { last unless $ARGV[0] =~ /^--(?:no-defaults$|(?:defaults-file|defaults-extra-file)=)/; push @defaults_options, (shift @ARGV); } foreach (@defaults_options) { $_ = quote_shell_word($_); } # Add [mysqld_multi] options to front of @ARGV, ready for GetOptions() unshift @ARGV, defaults_for_group('mysqld_multi'); # We've already handled --no-defaults, --defaults-file, etc. if (!GetOptions("help", "example", "version", "mysqld=s", "mysqladmin=s", "user=s", "password=s", "log=s", "no-log", "tcp-ip", "silent", "verbose")) { $flag_exit= 1; } usage() if ($opt_help); if ($opt_verbose && $opt_silent) { print "Both --verbose and --silent have been given. Some of the warnings "; print "will be disabled\nand some will be enabled.\n\n"; } init_log() if (!defined($opt_log)); $groupids = $ARGV[1]; if ($opt_version) { print "$my_progname version $VER by Jani Tolonen\n"; exit(0); } example() if ($opt_example); if ($flag_exit) { print "Error with an option, see $my_progname --help for more info.\n"; exit(1); } if (!defined(my_which(my_print_defaults))) { print "ABORT: Can't find command 'my_print_defaults'.\n"; print "This command is available from the latest MySQL\n"; print "distribution. Please make sure you have the command\n"; print "in your PATH.\n"; exit(1); } usage() if (!defined($ARGV[0]) || (!($ARGV[0] =~ m/^start$/i) && !($ARGV[0] =~ m/^stop$/i) && !($ARGV[0] =~ m/^reload$/i) && !($ARGV[0] =~ m/^report$/i))); if (!$opt_no_log) { w2log("$my_progname log file version $VER; run: ", "$opt_log", 1, 0); } else { print "$my_progname log file version $VER; run: "; print strftime "%a %b %e %H:%M:%S %Y", localtime; print "\n"; } if (($ARGV[0] =~ m/^start$/i) || ($ARGV[0] =~ m/^reload$/i)) { if (!defined(($mysqld= my_which($opt_mysqld))) && $opt_verbose) { print "WARNING: Couldn't find the default mysqld binary.\n"; print "Tried: $opt_mysqld\n"; print "This is OK, if you are using option \"mysqld=...\" in "; print "groups [mysqldN] separately for each.\n\n"; } if ($ARGV[0] =~ m/^start$/i) { start_mysqlds(); } elsif ($ARGV[0] =~ m/^reload$/i) { reload_mysqlds(); } } else { if (!defined(($mysqladmin= my_which($opt_mysqladmin))) && $opt_verbose) { print "WARNING: Couldn't find the default mysqladmin binary.\n"; print "Tried: $opt_mysqladmin\n"; print "This is OK, if you are using option \"mysqladmin=...\" in "; print "groups [mysqldN] separately for each.\n\n"; } if ($ARGV[0] =~ m/^report$/i) { report_mysqlds(); } else { stop_mysqlds(); } } } # # Quote word for shell # sub quote_shell_word { my ($option)= @_; $option =~ s!([^\w=./-])!\\$1!g; return $option; } sub defaults_for_group { my ($group) = @_; return () unless $my_print_defaults_exists; my $com= join ' ', 'my_print_defaults', @defaults_options, $group; my @defaults = `$com`; chomp @defaults; return @defaults; } #### #### Init log file. Check for appropriate place for log file, in the following #### order: my_print_defaults mysqld datadir, /usr/share/mysql-8.0 #### sub init_log { foreach my $opt (defaults_for_group('mysqld')) { if ($opt =~ m/^--datadir=(.*)/ && -d "$1" && -w "$1") { $logdir= $1; } } if (!defined($logdir)) { $logdir= "/usr/share/mysql-8.0" if (-d "/usr/share/mysql-8.0" && -w "/usr/share/mysql-8.0"); } if (!defined($logdir)) { # Log file was not specified and we could not log to a standard place, # so log file be disabled for now. if (!$opt_silent) { print "WARNING: Log file disabled. Maybe directory or file isn't writable?\n"; } $opt_no_log= 1; } else { $opt_log= "$logdir/mysqld_multi.log"; } } #### #### Report living and not running MySQL servers #### sub report_mysqlds { my (@groups, $com, $i, @options, $pec); print "Reporting MySQL servers\n"; if (!$opt_no_log) { w2log("\nReporting MySQL servers","$opt_log",0,0); } @groups = &find_groups($groupids); for ($i = 0; defined($groups[$i]); $i++) { $com= get_mysqladmin_options($i, @groups); $com.= " ping >> /dev/null 2>&1"; system($com); $pec = $? >> 8; if ($pec) { print "MySQL server from group: $groups[$i] is not running\n"; if (!$opt_no_log) { w2log("MySQL server from group: $groups[$i] is not running", "$opt_log", 0, 0); } } else { print "MySQL server from group: $groups[$i] is running\n"; if (!$opt_no_log) { w2log("MySQL server from group: $groups[$i] is running", "$opt_log", 0, 0); } } } if (!$i) { print "No groups to be reported (check your GNRs)\n"; if (!$opt_no_log) { w2log("No groups to be reported (check your GNRs)", "$opt_log", 0, 0); } } } #### #### start multiple servers #### sub start_mysqlds() { my (@groups, $com, $tmp, $i, @options, $j, $mysqld_found, $info_sent); if (!$opt_no_log) { w2log("\nStarting MySQL servers\n","$opt_log",0,0); } else { print "\nStarting MySQL servers\n"; } @groups = &find_groups($groupids); for ($i = 0; defined($groups[$i]); $i++) { @options = defaults_for_group($groups[$i]); $basedir_found= 0; # The default $mysqld_found= 1; # The default $mysqld_found= 0 if (!length($mysqld)); # Initialize the command. $com= "$mysqld"; # Initialize the command option list, process the options, # reset command if relevant, append key options to command line. for ($j = 0, $tmp= ""; defined($options[$j]); $j++) { if ("--datadir=" eq substr($options[$j], 0, 10)) { $datadir = $options[$j]; $datadir =~ s/\-\-datadir\=//; eval { mkpath($datadir) }; if ($@) { print "FATAL ERROR: Cannot create data directory $datadir: $!\n"; exit(1); } # Quote and append 'datadir' to command line. $options[$j]= quote_shell_word($options[$j]); $tmp.= " $options[$j]"; } elsif ("--mysqladmin=" eq substr($options[$j], 0, 13)) { # catch this and ignore } elsif ("--mysqld=" eq substr($options[$j], 0, 9)) { $options[$j]=~ s/\-\-mysqld\=//; # Reset command. $com= $options[$j]; $mysqld_found= 1; } elsif ("--basedir=" eq substr($options[$j], 0, 10)) { $basedir= $options[$j]; $basedir =~ s/^--basedir=//; $basedir_found= 1; # Quote and append 'basedir' to command line. $options[$j]= quote_shell_word($options[$j]); $tmp.= " $options[$j]"; } else { # Quote and append additional options to command line. $options[$j]= quote_shell_word($options[$j]); $tmp.= " $options[$j]"; } } if ($opt_verbose && $com =~ m/\/(safe_mysqld|mysqld_safe)$/ && !$info_sent) { print "WARNING: $1 is being used to start mysqld. In this case you "; print "may need to pass\n\"ledir=...\" under groups [mysqldN] to "; print "$1 in order to find the actual mysqld binary.\n"; print "ledir (library executable directory) should be the path to the "; print "wanted mysqld binary.\n\n"; $info_sent= 1; } # Prepare command line by appending command and option list, and redirect output. $com.= $tmp; $com.= " >> $opt_log 2>&1" if (!$opt_no_log); if (!$mysqld_found) { print "\n"; print "FATAL ERROR: Tried to start mysqld under group [$groups[$i]], "; print "but no mysqld binary was found.\n"; print "Please add \"mysqld=...\" in group [mysqld_multi], or add it to "; print "group [$groups[$i]] separately.\n"; exit(1); } if ($basedir_found) { $curdir=getcwd(); chdir($basedir) or die "Can't change to datadir $basedir"; } # Prepare datadir by initializing the server, unless this is already done. if (! -d $datadir."/mysql") { if (-w $datadir) { print "\n\nInstalling new database in $datadir\n\n"; system($com." --initialize"); } else { print "\n"; print "FATAL ERROR: Tried to create mysqld under group [$groups[$i]],\n"; print "but the data directory is not writable.\n"; print "data directory used: $datadir\n"; exit(1); } } if (! -d $datadir."/mysql") { print "\n"; print "FATAL ERROR: Tried to start mysqld under group [$groups[$i]],\n"; print "but no data directory was found or could be created.\n"; print "data directory used: $datadir\n"; exit(1); } # Start the command in the background. system($com." &"); if ($basedir_found) { chdir($curdir) or die "Can't change back to original dir $curdir"; } } if (!$i && !$opt_no_log) { w2log("No MySQL servers to be started (check your GNRs)", "$opt_log", 0, 0); } } #### #### reload multiple servers #### sub reload_mysqlds() { my (@groups, $com, $tmp, $i, @options, $j); if (!$opt_no_log) { w2log("\nReloading MySQL servers\n","$opt_log",0,0); } else { print "\nReloading MySQL servers\n"; } @groups = &find_groups($groupids); for ($i = 0; defined($groups[$i]); $i++) { $mysqld_server = $mysqld; @options = defaults_for_group($groups[$i]); for ($j = 0, $tmp= ""; defined($options[$j]); $j++) { if ("--mysqladmin=" eq substr($options[$j], 0, 13)) { # catch this and ignore } elsif ("--mysqld=" eq substr($options[$j], 0, 9)) { $options[$j] =~ s/\-\-mysqld\=//; $mysqld_server = $options[$j]; } elsif ("--pid-file=" eq substr($options[$j], 0, 11)) { $options[$j] =~ s/\-\-pid-file\=//; $pid_file = $options[$j]; } } $com = "killproc -p $pid_file -HUP $mysqld_server"; system($com); $com = "touch $pid_file"; system($com); } if (!$i && !$opt_no_log) { w2log("No MySQL servers to be reloaded (check your GNRs)", "$opt_log", 0, 0); } } ### #### stop multiple servers #### sub stop_mysqlds() { my (@groups, $com, $i, @options); if (!$opt_no_log) { w2log("\nStopping MySQL servers\n","$opt_log",0,0); } else { print "\nStopping MySQL servers\n"; } @groups = &find_groups($groupids); for ($i = 0; defined($groups[$i]); $i++) { $com= get_mysqladmin_options($i, @groups); $com.= " shutdown"; $com.= " >> $opt_log 2>&1" if (!$opt_no_log); $com.= " &"; system($com); } if (!$i && !$opt_no_log) { w2log("No MySQL servers to be stopped (check your GNRs)", "$opt_log", 0, 0); } } #### #### Sub function for mysqladmin option parsing #### sub get_mysqladmin_options { my ($i, @groups)= @_; my ($mysqladmin_found, $com, $tmp, $j); @options = defaults_for_group($groups[$i]); $mysqladmin_found= 1; # The default $mysqladmin_found= 0 if (!length($mysqladmin)); $com = "$mysqladmin"; $tmp = " -u $opt_user"; if (defined($opt_password)) { my $pw= $opt_password; # Protect single quotes in password $pw =~ s/'/'"'"'/g; $tmp.= " -p'$pw'"; } $tmp.= $opt_tcp_ip ? " -h 127.0.0.1" : ""; for ($j = 0; defined($options[$j]); $j++) { if ("--mysqladmin=" eq substr($options[$j], 0, 13)) { $options[$j]=~ s/\-\-mysqladmin\=//; $com= $options[$j]; $mysqladmin_found= 1; } elsif ((($options[$j] =~ m/^(\-\-socket\=)(.*)$/) && !$opt_tcp_ip) || ($options[$j] =~ m/^(\-\-port\=)(.*)$/)) { $tmp.= " $options[$j]"; } } if (!$mysqladmin_found) { print "\n"; print "FATAL ERROR: Tried to use mysqladmin in group [$groups[$i]], "; print "but no mysqladmin binary was found.\n"; print "Please add \"mysqladmin=...\" in group [mysqld_multi], or "; print "in group [$groups[$i]].\n"; exit(1); } $com.= $tmp; return $com; } # Return a list of option files which can be opened. Similar, but not # identical, to behavior of my_search_option_files() sub list_defaults_files { my %opt; foreach (@defaults_options) { return () if /^--no-defaults$/; $opt{$1} = $2 if /^--defaults-(extra-file|file)=(.*)$/; } return ($opt{file}) if exists $opt{file}; my %seen; # Don't list the same file more than once return grep { defined $_ and not $seen{$_}++ and -f $_ and -r $_ } ('/etc/my.cnf', '/etc/mysql/my.cnf', '/usr/my.cnf', ($ENV{MYSQL_HOME} ? "$ENV{MYSQL_HOME}/my.cnf" : undef), $opt{'extra-file'}, ($ENV{HOME} ? "$ENV{HOME}/.my.cnf" : undef)); } # Takes a specification of GNRs (see --help), and returns a list of matching # groups which actually are mentioned in a relevant config file sub find_groups { my ($raw_gids) = @_; my %gids; my @groups; if (defined($raw_gids)) { # Make a hash of the wanted group ids foreach my $raw_gid (split ',', $raw_gids) { # Match 123 or 123-456 my ($start, $end) = ($raw_gid =~ /^\s*(\d+)(?:\s*-\s*(\d+))?\s*$/); $end = $start if not defined $end; if (not defined $start or $end < $start or $start < 0) { print "ABORT: Bad GNR: $raw_gid; see $my_progname --help\n"; exit(1); } foreach my $i ($start .. $end) { # Use $i + 0 to normalize numbers (002 + 0 -> 2) $gids{$i + 0}= 1; } } } my @defaults_files = list_defaults_files(); #warn "@{[sort keys %gids]} -> @defaults_files\n"; foreach my $file (@defaults_files) { next unless open CONF, "< $file"; while () { if (/^\s*\[\s*(mysqld)(\d+)\s*\]\s*$/) { #warn "Found a group: $1$2\n"; # Use $2 + 0 to normalize numbers (002 + 0 -> 2) if (not defined($raw_gids) or $gids{$2 + 0}) { push @groups, "$1$2"; } } } close CONF; } return @groups; } #### #### w2log: Write to a logfile. #### 1.arg: append to the log file (given string, or from a file. if a file, #### file will be read from $opt_logdir) #### 2.arg: logfile -name (w2log assumes that the logfile is in $opt_logdir). #### 3.arg. 0 | 1, if true, print current date to the logfile. 3. arg will #### be ignored, if 1. arg is a file. #### 4.arg. 0 | 1, if true, first argument is a file, else a string #### sub w2log { my ($msg, $file, $date_flag, $is_file)= @_; my (@data); open (LOGFILE, ">>$opt_log") or die "FATAL: w2log: Couldn't open log file: $opt_log\n"; if ($is_file) { open (FROMFILE, "<$msg") && (@data=) && close(FROMFILE) or die "FATAL: w2log: Couldn't open file: $msg\n"; foreach my $line (@data) { print LOGFILE "$line"; } } else { print LOGFILE "$msg"; print LOGFILE strftime "%a %b %e %H:%M:%S %Y", localtime if ($date_flag); print LOGFILE "\n"; } close (LOGFILE); return; } #### #### my_which is used, because we can't assume that every system has the #### which -command. my_which can take only one argument at a time. #### Return values: requested system command with the first found path, #### or undefined, if not found. #### sub my_which { my ($command) = @_; my (@paths, $path); # If the argument is not 'my_print_defaults' then it would be of the format # / return $command if ($command ne 'my_print_defaults' && -f $command && -x $command); @paths = split(':', $ENV{'PATH'}); foreach $path (@paths) { $path .= "/$command"; return $path if (-f $path && -x $path); } return undef(); } #### #### example #### sub example { print <