2bbf447e6828d5e939f0e0008e1d5e69d65972d0
[u/mrichter/AliRoot.git] / STORAGE / setupStorageDatabase.sh
1 #!/bin/bash
2 HOST="localhost"   # IP of machine on which mysql database is located
3 PORT="5055"
4 DATABASE="storage"
5 USER="storage"
6 PASS="storage123"
7 TABLE="events"
8 STORAGE_PATH="/local/home/edis/storedFiles"
9 MAX_SIZE="5000000"
10 MAX_OCCUPATION="80"
11 REMOVE_PERCENT="60"
12 EVENTS_IN_FILE="7"
13 EVENT_SERVER="localhost"   # IP of machine running alieventserver
14 STORAGE_SERVER="localhost"      # IP of machine running alistorage
15 mysql -u root -pdaq -e "create database if not exists $DATABASE;"
16 mysql -u root -pdaq -e "grant ALL PRIVILEGES on $DATABASE.* to '$USER'@'$HOST' identified by '$PASS';"
17 mysql -u root -pdaq -e "use $DATABASE;"
18 mysql -u root -pdaq -e "CREATE TABLE IF NOT EXISTS $DATABASE.$TABLE(\
19 run_number int(6) NOT NULL,\
20 event_number int(6) NOT NULL,\
21 system text(7) DEFAULT NULL,\
22 multiplicity int(5) DEFAULT NULL,\
23 permanent tinyint(1) DEFAULT NULL,\
24 file_path text(100) DEFAULT NULL,\
25 PRIMARY KEY(run_number,event_number));"
26
27 echo "-----------------------------"
28 echo "Databases successfuly created"
29 echo "-----------------------------"
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51