summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BitKeeper/etc/logging_ok1
-rw-r--r--scripts/mysqld_multi.sh59
2 files changed, 58 insertions, 2 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index 4067304c8e1..b3533f2a834 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -52,6 +52,7 @@ hf@genie.(none)
igor@hundin.mysql.fi
igor@rurik.mysql.com
ingo@mysql.com
+jani@a80-186-24-72.elisa-laajakaista.fi
jani@dsl-jkl1657.dial.inet.fi
jani@dsl-kpogw4gb5.dial.inet.fi
jani@hynda.(none)
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index 3165a01362c..a4f2b18fda8 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -4,12 +4,12 @@ use Getopt::Long;
use POSIX qw(strftime);
$|=1;
-$VER="2.5";
+$VER="2.6";
$opt_config_file = undef();
$opt_example = 0;
$opt_help = 0;
-$opt_log = "/tmp/mysqld_multi.log";
+$opt_log = "";
$opt_mysqladmin = "@bindir@/mysqladmin";
$opt_mysqld = "@libexecdir@/mysqld";
$opt_no_log = 0;
@@ -18,6 +18,9 @@ $opt_tcp_ip = 0;
$opt_user = "root";
$opt_version = 0;
+my $my_print_defaults_exists= 1;
+my $logdir= undef();
+
my ($mysqld, $mysqladmin, $groupids, $homedir, $my_progname);
$homedir = $ENV{HOME};
@@ -42,7 +45,9 @@ sub main
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;
}
+ init_log();
my @defops = `my_print_defaults mysqld_multi`;
chop @defops;
splice @ARGV, 0, 0, @defops;
@@ -113,6 +118,56 @@ sub main
}
####
+#### Init log file. Check for appropriate place for log file, in the following
+#### order my_print_defaults mysqld datadir, @datadir@, /var/log, /tmp
+####
+
+sub init_log
+{
+ if ($my_print_defaults_exists)
+ {
+ @mysqld_opts= `my_print_defaults mysqld`;
+ chomp @mysqld_opts;
+ foreach my $opt (@mysqld_opts)
+ {
+ if ($opt =~ m/^\-\-datadir[=](.*)/)
+ {
+ if (-d "$1" && -w "$1")
+ {
+ $logdir= $1;
+ }
+ }
+ }
+ }
+ if (!defined($logdir))
+ {
+ $logdir= "@datadir@" if (-d "@datadir@" && -w "@datadir@");
+ }
+ if (!defined($logdir))
+ {
+ $logdir= "/var/log" if (-d "/var/log" && -w "/var/log");
+ }
+ if (!defined($logdir))
+ {
+ if (-d "/tmp" && -w "/tmp" && ! -e "/tmp/mysqld_multi.log")
+ {
+ $logdir= "/tmp";
+ }
+ }
+ if (!defined($logdir))
+ {
+ # We still couldn't get a default log file in place. Log file
+ # will be disabled unless user sets it with an option
+
+ $opt_no_log= 1;
+ }
+ else
+ {
+ $opt_log= "$logdir/mysqld_multi.log";
+ }
+}
+
+####
#### Report living and not running MySQL servers
####