#!/bin/bash # # Federated Computer Control Postgresql Service PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin config_listmonk() { echo -ne "\n* Configuring fstack/listmonk container.." spin & SPINPID=$! if [ ! -d "fstack/listmonk" ]; then mkdir -p fstack/listmonk/static fstack/listmonk/data/listmonk fi DOMAIN_ARRAY=(${DOMAIN//./ }) DOMAIN_FIRST=${DOMAIN_ARRAY[0]} DOMAIN_LAST=${DOMAIN_ARRAY[1]} cat > fstack/listmonk/docker-compose.yml < fstack/listmonk/data/listmonk/config.toml < /dev/null echo -ne "done." } start_listmonk() { # Start fstack/listmonk with output to /dev/null echo -ne "\n* Starting fstack/listmonk service.." spin & SPINPID=$! if [ $DEBUG ]; then # Start fstack/listmonk with output to console for debug docker-compose -f fstack/listmonk/docker-compose.yml -p listmonk up [ $? -eq 0 ] && echo -ne "done.\n" || fail "There was a problem starting service fstack/listmonk" else docker-compose -f fstack/listmonk/docker-compose.yml -p listmonk up -d &> /dev/null # Keep trying listmonk port 9000 to make sure it's up # before we proceed RETRY="30" while [ $RETRY -gt 0 ]; do nc -z 172.99.0.39 9000 &> /dev/null if [ $? -eq 0 ]; then break else if [ "$RETRY" == 1 ]; then docker-compose -f fstack/listmonk/docker-compose.yml -p listmonk down &> /dev/null kill -9 $SPINPID &> /dev/null fail "There was a problem starting service fstack/listmonk\nCheck the output of 'docker logs listmonk' or turn on\ndebug with -d" fi ((RETRY--)) sleep 7 fi done fi kill -9 $SPINPID &> /dev/null echo -ne "done." }