~dveeden/mysql-sandbox/mysql-sandbox

« back to all changes in this revision

Viewing changes to script_templates/process/change_ports.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
OLD_PORT=_SERVERPORT_
 
5
 
 
6
if [ "$1" = "" ]
 
7
then
 
8
    echo "new port required"
 
9
    exit
 
10
else
 
11
    NEW_PORT=$1
 
12
fi
 
13
 
 
14
if [ $OLD_PORT = $NEW_PORT ]
 
15
then
 
16
    echo Old port and new port must be different.
 
17
    exit
 
18
fi
 
19
 
 
20
PERL_SCRIPT1='BEGIN{$old=shift;$new=shift};'
 
21
PERL_SCRIPT2='s/sandbox$old/sandbox$new/g;'
 
22
PERL_SCRIPT3='s/\b$old\b/$new/' 
 
23
PERL_SCRIPT="$PERL_SCRIPT1 $PERL_SCRIPT2 $PERL_SCRIPT3"
 
24
 
 
25
SCRIPTS1="start stop send_kill clear restart my.sandbox.cnf "
 
26
SCRIPTS2="load_grants my use sandbox_env $0"
 
27
SCRIPTS="$SCRIPTS1 $SCRIPTS2"
 
28
for SCRIPT in $SCRIPTS
 
29
do
 
30
    perl -i.port.bak -pe "$PERL_SCRIPT" $OLD_PORT $NEW_PORT $SCRIPT
 
31
done
 
32
echo "($PWD) The old scripts have been saved as filename.port.bak"
 
33