File tree 1 file changed +19
-1
lines changed
1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 1
1
# !/usr/bin/perl
2
2
3
3
use Getopt::Long;
4
- use POSIX qw( strftime) ;
4
+ use POSIX qw( strftime getcwd ) ;
5
5
6
6
$| =1;
7
7
$VER =" 2.16" ;
@@ -295,6 +295,7 @@ sub start_mysqlds()
295
295
{
296
296
@options = defaults_for_group($groups [$i ]);
297
297
298
+ $basedir_found = 0; # The default
298
299
$mysqld_found = 1; # The default
299
300
$mysqld_found = 0 if (!length ($mysqld ));
300
301
$com = " $mysqld " ;
@@ -310,6 +311,14 @@ sub start_mysqlds()
310
311
$com = $options [$j ];
311
312
$mysqld_found = 1;
312
313
}
314
+ elsif (" --basedir=" eq substr ($options [$j ], 0, 10))
315
+ {
316
+ $basedir = $options [$j ];
317
+ $basedir =~ s / ^--basedir=// ;
318
+ $basedir_found = 1;
319
+ $options [$j ]= quote_shell_word($options [$j ]);
320
+ $tmp .= " $options [$j ]" ;
321
+ }
313
322
else
314
323
{
315
324
$options [$j ]= quote_shell_word($options [$j ]);
@@ -337,7 +346,16 @@ sub start_mysqlds()
337
346
print " group [$groups [$i ]] separately.\n " ;
338
347
exit (1);
339
348
}
349
+ if ($basedir_found )
350
+ {
351
+ $curdir =getcwd();
352
+ chdir ($basedir ) or die " Can't change to datadir $basedir " ;
353
+ }
340
354
system ($com );
355
+ if ($basedir_found )
356
+ {
357
+ chdir ($curdir ) or die " Can't change back to original dir $curdir " ;
358
+ }
341
359
}
342
360
if (!$i && !$opt_no_log )
343
361
{
You can’t perform that action at this time.
0 commit comments