3 #-----------------------------------------------------------------------------------#
5 # This is a template for script creating database for Storage Manager #
6 # and setting all necessary variables for Storage Manager, Event Display #
7 # and Online Reconstruction. #
9 # Rename the file and copy it to your home directory: #
11 # cp setupStorageDatabase_TEMPLATE.sh ~/setupStorageDatabase.sh #
13 # Then put all correct hostnames, ports, databases details and passwords. #
14 # REMEMBER: do not commit this file after putting any datails in it !!! #
17 # First time after installation you also need to run this script in order #
18 # to initialize the database (remember to grant necessary privilages to it). #
20 #-----------------------------------------------------------------------------------#
23 HOST="localhost" # IP of machine on which mysql database is located
29 STORAGE_PATH="/some/path/"
34 EVENT_SERVER="localhost" # IP of machine running alieventserver
35 EVENT_SERVER_USER="user"
36 EVENT_SERVER_PORT="124"
37 STORAGE_SERVER="localhost" # IP of machine running alistorage
38 STORAGE_SERVER_USER="user"
39 STORAGE_SERVER_PORT="125" # server thread communication port
40 STORAGE_CLIENT_PORT="126" # client thread communication port
41 XML_SERVER_PORT="127" # server of xml files
42 mysql -u root -ppassword -e "create database if not exists $DATABASE;"
43 mysql -u root -ppassword -e "grant ALL PRIVILEGES on $DATABASE.* to '$USER'@'$HOST' identified by '$PASS';"
44 mysql -u root -ppassword -e "use $DATABASE;"
45 mysql -u root -ppassword -e "CREATE TABLE IF NOT EXISTS $DATABASE.$TABLE(\
46 run_number int(6) NOT NULL,\
47 event_number int(6) NOT NULL,\
48 system text(7) DEFAULT NULL,\
49 multiplicity int(5) DEFAULT NULL,\
50 permanent tinyint(1) DEFAULT NULL,\
51 file_path text(100) DEFAULT NULL,\
52 PRIMARY KEY(run_number,event_number));"
54 echo "-----------------------------"
55 echo "Databases successfuly created"
56 echo "-----------------------------"