-
Notifications
You must be signed in to change notification settings - Fork 6
/
UpdateDatabases.sh
executable file
·52 lines (46 loc) · 1.54 KB
/
UpdateDatabases.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
svr="localhost"
user="root"
pass=$MYSQL_ROOT_PASSWORD
port="3306"
wdb="mangos0"
cdb="character0"
rdb="realmd"
UpdateWorld()
{
printf "Updating data into the World database ${wdb}\n"
for file in $(find /database/World/Updates/ -name '*.sql' -print)
do
printf "Applying update ${file}\n"
mysql -u $user -p$pass -s ${wdb} < ${file}
done
}
UpdateRealm()
{
printf "Updating data into the Realm database ${rdb}\n"
for file in $(find /database/Realm/Updates/ -name '*.sql' -print | grep -v 2015)
do
printf "Applying update ${file}\n"
mysql -u $user -p$pass -s ${rdb} < ${file}
done
}
UpdateCharacter()
{
printf "Updating data into the Character database ${db}\n"
for file in $(find /database/Character/Updates/ -name '*.sql' -print)
do
printf "Applying update ${file}\n"
mysql -u $user -p$pass -s ${cdb} < ${file}
done
}
#the update files check if they are valid themselves
#this means we don't need to know the order in which we install the updates
#we repeat 25 times to make sure all updates are done
#it will pick the right update each time we try.
#lazy i know, but it works.
#if after these updates the container won't start due to not detecting world database being update
#run /install/InstallWorld.sh to fix it
#make backups 'n all
for i in $(seq 1 25) ; do UpdateWorld ; done
for i in $(seq 1 25) ; do UpdateRealm ; done
for i in $(seq 1 25) ; do UpdateCharacter ; done