diff --git a/root/app/cleanup.sh b/root/app/cleanup.sh index b94f6a6..722eb30 100644 --- a/root/app/cleanup.sh +++ b/root/app/cleanup.sh @@ -1,5 +1,14 @@ #!/bin/bash +. /config/.env + +# define array for input values +declare -A DISKOVER_ARRAY +DISKOVER_ARRAY[REDIS_HOST]=${REDIS_HOST:-redis} +DISKOVER_ARRAY[REDIS_PORT]=${REDIS_PORT:-6379} + +DISKOVER_ARRAY[DISKOVER_OPTS]="${DISKOVER_ARRAY[DISKOVER_OPTS]} -i ${DISKOVER_ARRAY[INDEX_NAME]}" + # killing existing workers before starting new ones echo "killing existing workers..." if [ -f "/tmp/diskover_bot_pids" ]; then diff --git a/root/app/dispatcher.sh b/root/app/dispatcher.sh index a830c9b..5b310cf 100644 --- a/root/app/dispatcher.sh +++ b/root/app/dispatcher.sh @@ -17,20 +17,21 @@ DISKOVER_ARRAY[DISKOVER_OPTS]="${DISKOVER_ARRAY[DISKOVER_OPTS]} -i ${DISKOVER_AR cd /app/diskover || exit # Redis Cleanup +/bin/bash /app/cleanup.sh # killing existing workers before starting new ones -echo "killing existing workers..." -if [ -f "/tmp/diskover_bot_pids" ]; then - /bin/bash /app/diskover/diskover-bot-launcher.sh -k > /dev/null 2>&1 - sleep 3 -fi +#echo "killing existing workers..." +#if [ -f "/tmp/diskover_bot_pids" ]; then +# /bin/bash /app/diskover/diskover-bot-launcher.sh -k > /dev/null 2>&1 +# sleep 3 +#fi # empty existing redis queue -echo "emptying current redis queues..." -rq empty -u redis://"${DISKOVER_ARRAY[REDIS_HOST]}":"${DISKOVER_ARRAY[REDIS_PORT]}" diskover_crawl diskover diskover_calcdir failed -sleep 3 +#echo "emptying current redis queues..." +#rq empty -u redis://"${DISKOVER_ARRAY[REDIS_HOST]}":"${DISKOVER_ARRAY[REDIS_PORT]}" diskover_crawl diskover diskover_calcdir failed +#sleep 3 # kill dangling workers -echo "killing dangling workers..." -/bin/bash /app/diskover/diskover-bot-launcher.sh -k > /dev/null 2>&1 -sleep 3 +#echo "killing dangling workers..." +#/bin/bash /app/diskover/diskover-bot-launcher.sh -k > /dev/null 2>&1 +#sleep 3 # Start workers echo "starting workers with following options: ${DISKOVER_ARRAY[WORKER_OPTS]}" diff --git a/root/etc/services.d/rq-dashboard/run b/root/etc/services.d/rq-dashboard/run index 11efb04..a5f8012 100644 --- a/root/etc/services.d/rq-dashboard/run +++ b/root/etc/services.d/rq-dashboard/run @@ -6,36 +6,40 @@ . /config/.env # define array for input values -declare -A DISKOVER_ARRAY -DISKOVER_ARRAY[REDIS_HOST]=${REDIS_HOST:-redis} -DISKOVER_ARRAY[REDIS_PORT]=${REDIS_PORT:-6379} +#declare -A DISKOVER_ARRAY +#DISKOVER_ARRAY[REDIS_HOST]=${REDIS_HOST:-redis} +#DISKOVER_ARRAY[REDIS_PORT]=${REDIS_PORT:-6379} -DISKOVER_ARRAY[DISKOVER_OPTS]="${DISKOVER_ARRAY[DISKOVER_OPTS]} -i ${DISKOVER_ARRAY[INDEX_NAME]}" - -_term() { - #/bin/bash /app/cleanup.sh - # Redis Cleanup - # killing existing workers before starting new ones - echo "killing existing workers..." - if [ -f "/tmp/diskover_bot_pids" ]; then - /bin/bash /app/diskover/diskover-bot-launcher.sh -k > /dev/null 2>&1 - sleep 3 - fi - # empty existing redis queue - echo "emptying current redis queues..." - rq empty -u redis://"${DISKOVER_ARRAY[REDIS_HOST]}":"${DISKOVER_ARRAY[REDIS_PORT]}" diskover_crawl diskover diskover_calcdir failed - sleep 3 - # kill dangling workers - echo "killing dangling workers..." - /bin/bash /app/diskover/diskover-bot-launcher.sh -k > /dev/null 2>&1 - sleep 3 -} - -trap _term SIGTERM +#DISKOVER_ARRAY[DISKOVER_OPTS]="${DISKOVER_ARRAY[DISKOVER_OPTS]} -i ${DISKOVER_ARRAY[INDEX_NAME]}" declare -A REDIS_CONF REDIS_CONF[REDIS_HOST]=${REDIS_HOST:-redis} REDIS_CONF[REDIS_PORT]=${REDIS_PORT:-6379} +_term() { + /bin/bash /app/cleanup.sh + # Redis Cleanup + # killing existing workers before starting new ones + #echo "killing existing workers..." + #if [ -f "/tmp/diskover_bot_pids" ]; then + # /bin/bash /app/diskover/diskover-bot-launcher.sh -k > /dev/null 2>&1 + # sleep 3 + #fi + # empty existing redis queue + #echo "emptying current redis queues..." + #rq empty -u redis://"${DISKOVER_ARRAY[REDIS_HOST]}":"${DISKOVER_ARRAY[REDIS_PORT]}" diskover_crawl diskover diskover_calcdir failed + #sleep 3 + # kill dangling workers + #echo "killing dangling workers..." + #/bin/bash /app/diskover/diskover-bot-launcher.sh -k > /dev/null 2>&1 + #sleep 3 +} + +trap _term SIGTERM + +#declare -A REDIS_CONF +#REDIS_CONF[REDIS_HOST]=${REDIS_HOST:-redis} +#REDIS_CONF[REDIS_PORT]=${REDIS_PORT:-6379} + exec \ s6-setuidgid abc /usr/bin/rq-dashboard -H ${REDIS_CONF[REDIS_HOST]} -P ${REDIS_CONF[REDIS_PORT]} \ No newline at end of file