diff options
author | unknown <jani@a80-186-24-72.elisa-laajakaista.fi> | 2004-04-06 17:57:32 +0300 |
---|---|---|
committer | unknown <jani@a80-186-24-72.elisa-laajakaista.fi> | 2004-04-06 17:57:32 +0300 |
commit | ae3d22668921d11c584d7cf395f60ed29cb651d1 (patch) | |
tree | d4980575fca5fb3dc2747b889aa902bc19ce9bcb /scripts/mysqld_multi.sh | |
parent | f463848913ab86ec9d87cb24dd77d8c17a0e1deb (diff) | |
download | mariadb-git-ae3d22668921d11c584d7cf395f60ed29cb651d1.tar.gz |
Fixed a problem with mysqld_multi log file. The default is now datadir/mysqld_multi.log,
if doesn't exists or is not writable, then /var/log/mysqld_multi.log, if does not exists
or is not writable, then /tmp/mysqld_multi.log, but only in case the file does not yet
exists in /tmp. Otherwise log will be disabled, unless user explicitely sets it with an
option.
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
Diffstat (limited to 'scripts/mysqld_multi.sh')
-rw-r--r-- | scripts/mysqld_multi.sh | 59 |
1 files changed, 57 insertions, 2 deletions
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 #### |