Skip to content

Commit

Permalink
Merge pull request #37 from SoulGit/add_mysql_port_to_startup
Browse files Browse the repository at this point in the history
Add port flag to mysql connections in startup.sh
  • Loading branch information
scline authored Mar 28, 2018
2 parents 3ab100f + 46fa6c5 commit e550008
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,24 @@ if [ ! -f /cacti/install.lock ]; then
echo "$(date +%F_%R) [New Install] Container has been instructed to create new Database on remote system."
# initial database and user setup
echo "$(date +%F_%R) [New Install] CREATE DATABASE ${DB_NAME} /*\!40100 DEFAULT CHARACTER SET utf8 */;"
mysql -h ${DB_HOST} -uroot -p${DB_ROOT_PASS} -e "CREATE DATABASE ${DB_NAME} /*\!40100 DEFAULT CHARACTER SET utf8 */;"
mysql -h ${DB_HOST} --port=${DB_PORT} -uroot -p${DB_ROOT_PASS} -e "CREATE DATABASE ${DB_NAME} /*\!40100 DEFAULT CHARACTER SET utf8 */;"
# allow cacti user access to new database
echo "$(date +%F_%R) [New Install] GRANT ALL ON ${DB_NAME}.* TO '${DB_USER}' IDENTIFIED BY '*******';"
mysql -h ${DB_HOST} -uroot -p${DB_ROOT_PASS} -e "GRANT ALL ON ${DB_NAME}.* TO '${DB_USER}' IDENTIFIED BY '${DB_PASS}';"
mysql -h ${DB_HOST} --port=${DB_PORT} -uroot -p${DB_ROOT_PASS} -e "GRANT ALL ON ${DB_NAME}.* TO '${DB_USER}' IDENTIFIED BY '${DB_PASS}';"
# allow cacti user super access to new database (required to merge cacti.sql table)
echo "$(date +%F_%R) [New Install] GRANT SUPER ON *.* TO '${DB_USER}'@'%';"
mysql -h ${DB_HOST} -uroot -p${DB_ROOT_PASS} -e "GRANT SUPER ON *.* TO '${DB_USER}'@'%';"
mysql -h ${DB_HOST} --port=${DB_PORT} -uroot -p${DB_ROOT_PASS} -e "GRANT SUPER ON *.* TO '${DB_USER}'@'%';"
# allow required access to mysql timezone table
echo "$(date +%F_%R) [New Install] GRANT SELECT ON mysql.time_zone_name TO '${DB_USER}' IDENTIFIED BY '*******';"
mysql -h ${DB_HOST} -uroot -p${DB_ROOT_PASS} -e "GRANT SELECT ON mysql.time_zone_name TO '${DB_USER}' IDENTIFIED BY '${DB_PASS}';"
mysql -h ${DB_HOST} --port=${DB_PORT} -uroot -p${DB_ROOT_PASS} -e "GRANT SELECT ON mysql.time_zone_name TO '${DB_USER}' IDENTIFIED BY '${DB_PASS}';"
fi

# CRON
cp /template_configs/crontab /etc/crontab

# fresh install db merge
echo "$(date +%F_%R) [New Install] Merging vanilla cacti.sql file to database."
mysql -h ${DB_HOST} -u${DB_USER} -p${DB_PASS} ${DB_NAME} < /cacti/cacti.sql
mysql -h ${DB_HOST} --port=${DB_PORT} -u${DB_USER} -p${DB_PASS} ${DB_NAME} < /cacti/cacti.sql

echo "$(date +%F_%R) [New Install] Installing supporting template files."
cp -r /templates/resource/* /cacti/resource
Expand All @@ -86,7 +86,7 @@ if [ ! -f /cacti/install.lock ]; then
# install additional settings
for filename in /settings/*.sql; do
echo "$(date +%F_%R) [New Install] Importing settings file $filename"
mysql -h ${DB_HOST} -u${DB_USER} -p${DB_PASS} ${DB_NAME} < $filename
mysql -h ${DB_HOST} --port=${DB_PORT} -u${DB_USER} -p${DB_PASS} ${DB_NAME} < $filename
done

# install additional templates
Expand Down

0 comments on commit e550008

Please sign in to comment.