From 0caced63f2f1c6400cab66368795ee298782af9e Mon Sep 17 00:00:00 2001 From: kenshin-samourai Date: Mon, 30 Dec 2019 14:53:11 +0100 Subject: [PATCH] check if dojo is running (start and stop commands) --- docker/my-dojo/dojo.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docker/my-dojo/dojo.sh b/docker/my-dojo/dojo.sh index 1627940..089cd93 100755 --- a/docker/my-dojo/dojo.sh +++ b/docker/my-dojo/dojo.sh @@ -50,11 +50,24 @@ docker_up() { # Start start() { - docker_up --remove-orphans + # Check if dojo is running (check the db container) + isRunning=$(docker inspect --format="{{.State.Running}}" db 2> /dev/null) + + if [ $? -eq 1 ] || [ "$isRunning" == "false" ]; then + docker_up --remove-orphans + else + echo "Dojo is already running." + fi } # Stop stop() { + # Check if dojo is running (check the db container) + isRunning=$(docker inspect --format="{{.State.Running}}" db 2> /dev/null) + if [ $? -eq 1 ] || [ "$isRunning" == "false" ]; then + echo "Dojo is already stopped." + exit + fi # Shutdown the bitcoin daemon if [ "$BITCOIND_INSTALL" == "on" ]; then # Renewal of bitcoind onion address