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 |
| 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__" |