~daniel-nichter/mysql-sandbox/any-package-support

« back to all changes in this revision

Viewing changes to lib/MySQL/Sandbox/Scripts.pm

  • Committer: Giuseppe Maxia
  • Date: 2010-04-06 16:00:41 UTC
  • Revision ID: g.maxia@gmail.com-20100406160041-wpi1t580w2jqdfak
- added a check in the 'start' script to verify that mysqld_safe exists and does can run properly.
- Added an exit code to the 'start' script to alert when the server does not start
- added help to make_sandbox_from_installed. Added /usr/sbin as source directory
- added instructions to the 'clear' script to remove functions and plugins 

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
our @EXPORT_OK = qw( scripts_in_code);
11
11
our @EXPORT = @EXPORT_OK;
12
12
 
13
 
our $VERSION="3.0.08";
 
13
our $VERSION="3.0.09";
14
14
 
15
15
our @MANIFEST = (
16
16
'clear.sh',
722
722
MYSQLD_SAFE="$BASEDIR/bin/_MYSQLDSAFE_"
723
723
SBDIR="_HOME_DIR_/_SANDBOXDIR_"
724
724
PIDFILE="$SBDIR/data/mysql_sandbox_SERVERPORT_.pid"
 
725
if [ ! -f $MYSQLD_SAFE ]
 
726
then
 
727
    echo "mysqld_safe not found in $BASEDIR/bin/"
 
728
    exit 1
 
729
fi
 
730
MYSQLD_SAFE_OK=`sh -n $MYSQLD_SAFE 2>&1`
 
731
if [ "$MYSQLD_SAFE_OK" == "" ]
 
732
then
 
733
    if [ "$SBDEBUG" == "2" ] 
 
734
    then
 
735
        echo "$MYSQLD_SAFE OK"
 
736
    fi
 
737
else
 
738
    echo "$MYSQLD_SAFE has errors"
 
739
    echo "((( $MYSQLD_SAFE_OK )))"
 
740
    exit 1
 
741
fi
725
742
TIMEOUT=60
726
743
if [ -f $PIDFILE ]
727
744
then
754
771
    echo " sandbox server started"
755
772
else
756
773
    echo " sandbox server not started yet"
 
774
    exit 1
757
775
fi
758
776
 
759
777
START_SCRIPT
877
895
        echo 'drop database `'$D'`' | ./use 
878
896
    done
879
897
    VERSION=`./use -N -B  -e 'select version()'`
 
898
    if [ `perl -le 'print $ARGV[0] ge "5.0" ? "1" : "0" ' "$VERSION"` = "1" ]
 
899
    then
 
900
        ./use -e "truncate mysql.proc"
 
901
        ./use -e "truncate mysql.func"
 
902
    fi
880
903
    if [ `perl -le 'print $ARGV[0] ge "5.1" ? "1" : "0" ' "$VERSION"` = "1" ]
881
904
    then
882
905
        ./use -e "truncate mysql.general_log"
883
906
        ./use -e "truncate mysql.slow_log"
 
907
        ./use -e "truncate mysql.plugin"
 
908
        ./use -e "truncate mysql.proc"
 
909
        ./use -e "truncate mysql.func"
884
910
    fi
885
911
fi
886
912