1
#!/Users/gmax/usr/local/bin/bash
3
# Copyright (C) 2006,2007,2008,2009 Giuseppe Maxia
4
# Contacts: http://datacharmer.org
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
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.
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
24
echo "new port required"
30
if [ $OLD_PORT = $NEW_PORT ]
32
echo Old port and new port must be different.
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"
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
46
perl -i.port.bak -pe "$PERL_SCRIPT" $OLD_PORT $NEW_PORT $SCRIPT
48
echo "($PWD) The old scripts have been saved as filename.port.bak"