diff --git a/container_files/bin/cleanup.sh b/container_files/bin/cleanup.sh index 7fd2a8a..5500b98 100755 --- a/container_files/bin/cleanup.sh +++ b/container_files/bin/cleanup.sh @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -log=/tmp/cleanup.log +log=/opt/log/cleanup.log date >> $log diff --git a/container_files/bin/configure_httpd.sh b/container_files/bin/configure_httpd.sh index b3d5850..b02ac3d 100755 --- a/container_files/bin/configure_httpd.sh +++ b/container_files/bin/configure_httpd.sh @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -log="/tmp/httpd.log" +log="/opt/log/httpd.log" date >> $log echo "Configuring httpd: " >> $log echo "Parsing COMANAGE_SERVER_FQDN to $COMANAGE_SERVER_FQDN in virtualhost 80 and 443" >> $log diff --git a/container_files/bin/configure_php.sh b/container_files/bin/configure_php.sh index 982e96b..6d3b034 100755 --- a/container_files/bin/configure_php.sh +++ b/container_files/bin/configure_php.sh @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -log="/tmp/php.log" +log="/opt/log/php.log" date >> $log echo "Configuring php: " >> $log @@ -54,7 +54,7 @@ else exit 1 fi date >> $log - echo "First database input was completed whithout any error" >> $log + echo "First database input was completed without any error" >> $log echo "Doing variable parsing" >> $log sed -i "s|ADMIN_NAME|$ADMIN_NAME|g" /opt/bin/configure_php_user.sh sed -i "s|ADMIN_FAMILY|$ADMIN_FAMILY|g" /opt/bin/configure_php_user.sh diff --git a/container_files/bin/configure_php_user.sh b/container_files/bin/configure_php_user.sh index 9ee7730..4903097 100755 --- a/container_files/bin/configure_php_user.sh +++ b/container_files/bin/configure_php_user.sh @@ -14,10 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. # -log=/tmp/php-user.sh +log=/opt/log/php-user.sh date >> $log -cd /opt/comanage/comanage-registry-$VERSION/app -echo "Performing database user setup" >> $log -./Console/cake setup --admin-given-name ADMIN_NAME --admin-family-name ADMIN_FAMILY --admin-username ADMIN_USERNAME --enable-pooling=No --force >> $log + +schema=$( mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -h "$MYSQL_HOST" $MYSQL_DATABASE -e 'desc cm_users' ) +laststatus=$? + +if [ ! $laststatus -eq 0 ]; then + cd /opt/comanage/comanage-registry-$VERSION/app + echo "Performing database user setup" >> $log + ./Console/cake setup --admin-given-name ADMIN_NAME --admin-family-name ADMIN_FAMILY --admin-username ADMIN_USERNAME --enable-pooling=No --force >> $log +else + echo "table cm_users exists, skipping provisioning" >> $log +fi + + diff --git a/container_files/bin/configure_shibd.sh b/container_files/bin/configure_shibd.sh index eaed84f..392c8e0 100755 --- a/container_files/bin/configure_shibd.sh +++ b/container_files/bin/configure_shibd.sh @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -log="/tmp/shibd.log" +log="/opt/log/shibd.log" date >> $log echo "Configuring shibd: " > $log if [[ $COMANAGE_SERVER_FQDN && ${COMANAGE_SERVER_FQDN-x} ]]; then diff --git a/container_files/bin/main.sh b/container_files/bin/main.sh index 80a811d..845b2e0 100755 --- a/container_files/bin/main.sh +++ b/container_files/bin/main.sh @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -log="/tmp/start-main.log" +log="/opt/log/start-main.log" echo "Starting Container: " > $log date >> $log diff --git a/container_files/bin/start.sh b/container_files/bin/start.sh index 6d843b9..5dab793 100755 --- a/container_files/bin/start.sh +++ b/container_files/bin/start.sh @@ -42,25 +42,6 @@ else echo "Testing connectivity to database before continue with install" >> $log echo "Testing connectivity to database before continue with install" /opt/wait-for-it/wait-for-it.sh $MYSQL_HOST:3306 -t $WAIT_TIME --strict -- /opt/bin/main.sh >> $log - echo "Mariadb default port is open and test connection ok" - echo "Mariadb default port is open and test connection ok" >> $log - echo "Testing connectivy to database before continue with install" >> $log - echo "Testing connectivy to database before continue with install" - mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -h "$MYSQL_HOST" -e "use $MYSQL_DATABASE; show tables;" - laststatus="$?" - echo "checking connectivity" >> $log - while [ "$laststatus" != "0" ]; do - mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -h "$MYSQL_HOST" -e "use $MYSQL_DATABASE; show tables;" - laststatus="$?" - sleep 5 - date >> $log - echo "Trying to connect to mariadb container with $MYSQL_USER to database $MYSQL_DATABASE" - echo "Trying to connect to mariadb container with $MYSQL_USER to database $MYSQL_DATABASE" >> $log - done - echo "Database Connection with $MYSQL_USER to database $MYSQL_DATABASE was completed without any error" >> $log - echo "Database Connection with $MYSQL_USER to database $MYSQL_DATABASE was completed without any error" - date >> $log - /opt/bin/main.sh laststatus="$?" echo "main.sh last status: $laststatus" if [ "$laststatus" != "0" ]; then