~dveeden/mysql-sandbox/mysql-sandbox

« back to all changes in this revision

Viewing changes to script_templates/process/clear.sh

  • Committer: Giuseppe Maxia
  • Date: 2009-05-09 08:04:44 UTC
  • Revision ID: g.maxia@gmail.com-20090509080444-jy8a330el0mt425a
Tags: 3.0
- 3.0.00 GA release
- no code modification. Same codebase as 2.0.99f
- completed cookbook (41 recipes in MySQL::Sandbox::Recipes)
- added script_templates directory (No modification in current version, just preparation for 3.1.xx)
- added drafts directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!_BINBASH_
 
2
__LICENSE__
 
3
 
 
4
#-----------------------------------------
 
5
SBDIR="_HOME_DIR_/_SANDBOXDIR_"
 
6
. "$SBDIR/sandbox_env"
 
7
#-----------------------------------------
 
8
cd $SBDIR
 
9
 
 
10
#
 
11
# attempt to drop databases gracefully
 
12
#
 
13
if [ -f $PIDFILE ]
 
14
then
 
15
    for D in `echo "show databases " | ./use -B -N | grep -v "^mysql$" | grep -v "^information_schema$"` 
 
16
    do
 
17
        echo 'drop database `'$D'`' | ./use 
 
18
    done
 
19
    VERSION=`./use -N -B  -e 'select version()'`
 
20
    if [ `perl -le 'print $ARGV[0] ge "5.1" ? "1" : "0" ' "$VERSION"` = "1" ]
 
21
    then
 
22
        ./use -e "truncate mysql.general_log"
 
23
        ./use -e "truncate mysql.slow_log"
 
24
    fi
 
25
fi
 
26
 
 
27
./stop
 
28
#./send_kill
 
29
rm -f data/`hostname`*
 
30
rm -f data/log.0*
 
31
rm -f data/*.log
 
32
rm -f data/falcon*
 
33
rm -f data/mysql-bin*
 
34
rm -f data/*relay-bin*
 
35
rm -f data/ib*
 
36
rm -f data/*.info
 
37
rm -f data/*.err
 
38
rm -f data/*.err-old
 
39
# rm -rf data/test/*
 
40
 
 
41
#
 
42
# remove all databases if any
 
43
#
 
44
for D in `ls -d data/*/ | grep -w -v mysql ` 
 
45
do
 
46
    rm -rf $D
 
47
done
 
48
mkdir data/test
 
49