1#!/bin/bash
 2
 3# Start a worker process
 4
 5if [[ -n "${CHART_WORKER_MAX_WEIGHT}" ]]; then
 6    MAXWEIGHT="--max-weight ${CHART_WORKER_MAX_WEIGHT}"
 7else
 8    MAXWEIGHT=""
 9fi
10
11if [[ -n "${CHART_WORKER_ONLY_INGESTION}" ]]; then
12    FILTER="--only-ingestion"
13elif [[ -n "${CHART_WORKER_NO_INGESTION}" ]]; then
14    FILTER="--exclude-ingestion"
15else
16    FILTER=""
17fi
18
19# Don't use exec as we want to chain run the sleep command
20# (and sendmail perhaps) so the docker auto restart will give us some time
21# before rebooting
22
23${CHART_LAUNCHER_NAME} worker \
24     --rotating-log-file ${CHART_LOG_DIR}/${CHART_WORKER_NAME}.log \
25     --name ${CHART_WORKER_NAME} \
26     ${MAXWEIGHT} ${FILTER} \
27     --loop \
28     --batch-size ${CHART_BATCH_SIZE:-7} \
29     ; sleep 3600
30     # && sendmail ${CHART_ADMIN} < crash_email_message \