Skip to content

Commit

Permalink
start script for docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-François Pucheu committed Jan 7, 2017
1 parent 7dcb588 commit e391495
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions mydombox.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
#!/bin/sh

DATABASE_EXIST=$(mysql -u root -e "show databases;" | grep "^mydombox" | wc -l)
DATABASE_EXIST=$(mysql -u root -pmydomboxpwd -e "show databases;" | grep "^mydombox" | wc -l)

if [ $DATABASE_EXIST -eq 0 ]
then
mysql -u root < /etc/mydombox/database/Create_mydombox_0-6-2.sql
mysql -u root -pmydomboxpwd < /etc/mydombox/database/Create_mydombox_0-6-2.sql
fi

VERSION=$( mysql -u root mydombox -e "SELECT MAX(db_version) FROM database_version;" |awk -F\| '{ print $1 }' | grep -v db_version)
VERSION=$( mysql -u root mydombox -pmydomboxpwd -e "SELECT MAX(db_version) FROM database_version;" |awk -F\| '{ print $1 }' | grep -v db_version)

if [ "${VERSION}" = "0.5.0" ]
then
mysql -u root < /etc/mydombox/database/Migration_mydombox_0-5-0_to_0-6-0.sql
mysql -u root -pmydomboxpwd < /etc/mydombox/database/Migration_mydombox_0-5-0_to_0-6-0.sql
fi
if [ "${VERSION}" = "0.6.0" ]
then
mysql -u root < /etc/mydombox/database/Migration_mydombox_0-6-0_to_0-6-1.sql
mysql -u root -pmydomboxpwd < /etc/mydombox/database/Migration_mydombox_0-6-0_to_0-6-1.sql
fi

if [ "${VERSION}" = "0.6.1" ]
then
mysql -u root < /etc/mydombox/database/Migration_mydombox_0-6-1_to_0-6-2.sql
mysql -u root -pmydomboxpwd < /etc/mydombox/database/Migration_mydombox_0-6-1_to_0-6-2.sql
fi


mysql -u root < /etc/mydombox/database/Populate_mydombox_0-6-0.sql
mysql -u root -e "grant all privileges on mydombox.* to mydombox@localhost identified by 'mydomboxpwd';"
mysql -u root -pmydomboxpwd < /etc/mydombox/database/Populate_mydombox_0-6-0.sql
mysql -u root -pmydomboxpwd -e "grant all privileges on mydombox.* to mydombox@localhost identified by 'mydomboxpwd';"

/usr/sbin/mydombox /etc/mydombox/mydombox.conf

0 comments on commit e391495

Please sign in to comment.