Last active
August 29, 2015 14:05
-
-
Save neosergio/45ee2f6ee4e039dc75ab to your computer and use it in GitHub Desktop.
Bash script to quick reinstall of a mbanking server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd ~ | |
rm *.property* | |
wget https://gist.githubusercontent.com/neosergio/76b91816239f9cdab3d8/raw/74112f73280d9ce339fb32e3be30f169ccb2f252/mbanking-database-install.property | |
wget https://gist.githubusercontent.com/neosergio/6ab217e00fde9380c219/raw/b3c1d781585f1ea2eaee94c73ee9cd9972a61fd9/mbanking-configuration-install.property | |
wget https://gist.githubusercontent.com/neosergio/790f851cce9785815fd5/raw/aa109702a9ecfb7db22306f9a2d2d94f1568af20/mbanking-server-install.property | |
wget https://gist.githubusercontent.com/neosergio/87df7af335a65912fadc/raw/fafc8477fcc17f54c916c36a26330a1ed577cb61/mb-testharness-database.property | |
wget https://gist.githubusercontent.com/neosergio/8c218258c1e28e4c43dc/raw/3f21574ae03da2cac58dc6285aada88dd83eb9a6/mb-testharness-server.property | |
while getopts ":m:f:d" opt; do | |
case $opt in | |
m) | |
echo "Installing mbanking" >&2 | |
rm -R jboss/ | |
unzip jboss-eap-5.2.0.zip | |
mv jboss-eap-5.2 jboss | |
tar -xvzf $OPTARG | |
folder=$(echo "$OPTARG" | sed -r 's/\.[[:alnum:]]+\.[[:alnum:]]+$//') | |
cd ~/$folder | |
sh install.sh --database -p ~/mbanking-database-install.property | |
sh install.sh --configuration -p ~/mbanking-configuration-install.property | |
sh install.sh --server -p ~/mbanking-server-install.property | |
;; | |
f) | |
cd ~ | |
rm -R fred && mkdir fred | |
cp $OPTARG fred/ | |
cd ~/fred | |
java -jar $OPTARG --database -p ~/mb-testharness-database.property | |
java -jar $OPTARG --server -p ~/mb-testharness-server.property | |
;; | |
d) | |
mysql -u root --password=toor -e "DROP DATABASE IF EXISTS mbanking_3_3; DROP DATABASE IF EXISTS mbanking_3_3_jms; DROP DATABASE IF EXISTS testharnessv2;" | |
mysql -u root --password=toor -e "DROP USER 'mfadmin'@'localhost'; DROP USER 'mfadminjms'@'localhost'; DROP USER 'mfapp'@'localhost'; DROP USER 'mfjms'@'localhost';" | |
mysql -u root --password=toor -e "CREATE USER 'mfadmin'@'localhost' IDENTIFIED BY 'mfadmin';" | |
mysql -u root --password=toor -e "CREATE USER 'mfadminjms'@'localhost' IDENTIFIED BY 'mfadminjms';" | |
mysql -u root --password=toor -e "CREATE USER 'mfapp'@'localhost' IDENTIFIED BY 'mfapp';" | |
mysql -u root --password=toor -e "CREATE USER 'mfjms'@'localhost' IDENTIFIED BY 'mfjms';" | |
mysql -u root --password=toor -e "GRANT ALL PRIVILEGES ON *.* TO 'mfadmin'@'localhost' WITH GRANT OPTION;" | |
mysql -u root --password=toor -e "GRANT ALL PRIVILEGES ON *.* TO 'mfadminjms'@'localhost' WITH GRANT OPTION;" | |
mysql -u root --password=toor -e "GRANT ALL PRIVILEGES ON *.* TO 'mfapp'@'localhost' WITH GRANT OPTION;" | |
mysql -u root --password=toor -e "GRANT ALL PRIVILEGES ON *.* TO 'mfjms'@'localhost' WITH GRANT OPTION;" | |
mysql -u mfadmin --password=mfadmin -e "CREATE SCHEMA mbanking_3_3;" | |
mysql -u mfadmin --password=mfadmin -e "CREATE SCHEMA testharnessv2;" | |
mysql -u mfadmin --password=mfadmin -e "GRANT SELECT, INSERT, UPDATE, DELETE, EXECUTE, ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE VIEW, DROP, INDEX, TRIGGER ON mbanking_3_3.* TO mfadmin; GRANT SELECT, INSERT, UPDATE, DELETE, EXECUTE, ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE VIEW, DROP, INDEX, TRIGGER ON mbanking_3_3.* TO mfapp;" | |
mysql -u mfadminjms --password=mfadminjms -e "CREATE SCHEMA mbanking_3_3_jms;" | |
mysql -u mfadminjms --password=mfadminjms -e "GRANT SELECT, INSERT, UPDATE, DELETE, EXECUTE, ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE VIEW, DROP, INDEX, TRIGGER ON mbanking_3_3_jms.* TO mfadmimjms; GRANT SELECT, INSERT, UPDATE, DELETE, EXECUTE, ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE VIEW, DROP, INDEX, TRIGGER ON mbanking_3_3_jms.* TO mfjms;" | |
echo "Databases ready!" | |
;; | |
\?) | |
echo "Invalid option: -$OPTARG" >&2 | |
exit 1 | |
;; | |
:) | |
echo "Option -$OPTARG requires an argument." >&2 | |
echo "Usage: sh reinstall-mbanking.sh -m <mbanking_installer_X.X.X.XXX> -f <mb-test-harness-installer_X.X.X.XXX> -d" | |
echo "m parameter is for mbanking_installer, f parameter is for mb-test-harness-installer, d is for reset database" | |
exit 1 | |
;; | |
esac | |
done |
Consider the message center pre configuration for the next version
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Probably is good to remove properties files and also fred folder, consider those for the next upgrade. (delete fred folder)