#!/bin/bash
#
# Copyright (c) 2020 Bubble, Inc.  All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
#
#
# Truncate all bubble logs
#
BUBBLE_LOGS_DIR=/var/log/bubble
if [[ ! -d ${BUBBLE_LOGS_DIR} ]] ; then
  echo "BUBBLE_LOGS_DIR not found, nothing to truncate: ${BUBBLE_LOGS_DIR}"
  exit 0
fi

find ${BUBBLE_LOGS_DIR} -type f | while read log ; do
  cat /dev/null > ${log} && echo "truncated ${log}" || echo "error truncating ${log}"
done
