~dveeden/mysql-sandbox/mysql-sandbox

« back to all changes in this revision

Viewing changes to script_templates/samples/change_ports

  • 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
#!/Users/gmax/usr/local/bin/bash
 
2
#    The MySQL Sandbox
 
3
#    Copyright (C) 2006,2007,2008,2009 Giuseppe Maxia
 
4
#    Contacts: http://datacharmer.org
 
5
#
 
6
#    This program is free software; you can redistribute it and/or modify
 
7
#    it under the terms of the GNU General Public License as published by
 
8
#    the Free Software Foundation; version 2 of the License
 
9
#
 
10
#    This program is distributed in the hope that it will be useful,
 
11
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
#    GNU General Public License for more details.
 
14
#
 
15
#    You should have received a copy of the GNU General Public License
 
16
#    along with this program; if not, write to the Free Software
 
17
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 
 
19
 
 
20
OLD_PORT=5134
 
21
 
 
22
if [ "$1" = "" ]
 
23
then
 
24
    echo "new port required"
 
25
    exit
 
26
else
 
27
    NEW_PORT=$1
 
28
fi
 
29
 
 
30
if [ $OLD_PORT = $NEW_PORT ]
 
31
then
 
32
    echo Old port and new port must be different.
 
33
    exit
 
34
fi
 
35
 
 
36
PERL_SCRIPT1='BEGIN{$old=shift;$new=shift};'
 
37
PERL_SCRIPT2='s/sandbox$old/sandbox$new/g;'
 
38
PERL_SCRIPT3='s/\b$old\b/$new/' 
 
39
PERL_SCRIPT="$PERL_SCRIPT1 $PERL_SCRIPT2 $PERL_SCRIPT3"
 
40
 
 
41
SCRIPTS1="start stop send_kill clear restart my.sandbox.cnf "
 
42
SCRIPTS2="load_grants my use sandbox_env $0"
 
43
SCRIPTS="$SCRIPTS1 $SCRIPTS2"
 
44
for SCRIPT in $SCRIPTS
 
45
do
 
46
    perl -i.port.bak -pe "$PERL_SCRIPT" $OLD_PORT $NEW_PORT $SCRIPT
 
47
done
 
48
echo "($PWD) The old scripts have been saved as filename.port.bak"
 
49