Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | catch_non_zero() { |
| 3 | CMD=${1} |
| 4 | ${CMD} > /dev/null |
| 5 | EC=$? |
| 6 | if [ ${EC} -ne 0 ]; then |
| 7 | echo "Command ${CMD} failed to execute, exit code was ${EC}" |
| 8 | fi |
| 9 | } |
| 10 | source /source_env.sh |
| 11 | # Do not attempt to write to slave |
| 12 | if [[ ! -z ${REDIS_SLAVEOF_IP} ]]; then |
| 13 | REDIS_CMDLINE="redis-cli -h ${REDIS_SLAVEOF_IP} -p ${REDIS_SLAVEOF_PORT}" |
| 14 | else |
| 15 | REDIS_CMDLINE="redis-cli -h redis -p 6379" |
| 16 | fi |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 17 | catch_non_zero "${REDIS_CMDLINE} LTRIM ACME_LOG 0 ${LOG_LINES}" |
| 18 | catch_non_zero "${REDIS_CMDLINE} LTRIM POSTFIX_MAILLOG 0 ${LOG_LINES}" |
| 19 | catch_non_zero "${REDIS_CMDLINE} LTRIM DOVECOT_MAILLOG 0 ${LOG_LINES}" |
| 20 | catch_non_zero "${REDIS_CMDLINE} LTRIM SOGO_LOG 0 ${LOG_LINES}" |
| 21 | catch_non_zero "${REDIS_CMDLINE} LTRIM NETFILTER_LOG 0 ${LOG_LINES}" |
| 22 | catch_non_zero "${REDIS_CMDLINE} LTRIM AUTODISCOVER_LOG 0 ${LOG_LINES}" |
| 23 | catch_non_zero "${REDIS_CMDLINE} LTRIM API_LOG 0 ${LOG_LINES}" |
| 24 | catch_non_zero "${REDIS_CMDLINE} LTRIM RL_LOG 0 ${LOG_LINES}" |
| 25 | catch_non_zero "${REDIS_CMDLINE} LTRIM WATCHDOG_LOG 0 ${LOG_LINES}" |