mynode/rootfs/standard/usr/bin/mynode_post_dojo.sh
LightningSats 93281a7c23
Add Samourai Dojo to MyNode (#143)
+added files
*dojo.service
*mynode_gen_dojo_config.sh
*mynode_post_dojo.sh
*dojo.py
*dojo.html

%modified files
*mynode_firewall.sh
*mynode_post_upgrade.sh
*mynode_stop_critical_services.sh
*bitcoin.conf
*enable_disable_functions.py
*mynode.py
*apps.html

Special thanks to Taylor Helsper for creating MyNode and Merging Dojo

Special thanks to BTCxZelko for getting me started with Dojo and 
assisting with the code. 

Special thanks to Amiga500 for helping with testing.

Co-authored-by: Taylor Helsper <tehelsper@gmail.com>
2020-02-27 19:25:33 -06:00

36 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
set -e
sleep 10s #dojo needs time to start before passing next line
# initalize mysql db (REQUIRED TO START MYSQL)
counter=0
target=50
isRunning=""
MYSQL_DATABASE=samourai-main
# check on loop if mysql db is running. when running initialize
while [ $counter != $target ]
do
source /opt/mynode/dojo/docker/my-dojo/conf/docker-mysql.conf || exit 0
# Check if dojo mysql db is running (check the db container)
isRunning=$(docker inspect --format="{{.State.Running}}" db)
if [ $isRunning == "true" ]; then
sleep 20s
docker exec -i db bash -c "mysql -h db -u root -p$MYSQL_ROOT_PASSWORD $MYSQL_DATABASE" </opt/mynode/dojo/db-scripts/1_db.sql
echo "dojo mysql db initalized"
sleep 5s
#Stop dojo after install/update and initalization is complete
cd /opt/mynode/dojo/docker/my-dojo
sudo ./dojo.sh stop
counter=$target
else
echo "waiting to initalize dojo mysql db - retrying $[ $target-$counter ] more times"
counter=$(( $counter + 1 ))
sleep 30s
fi
done || exit 0