#!/usr/bin/env bash
set -e

# The application requires the existence of logs directories.
mkdir -p "${AVIA_WIZARD_LOG_PATH}" "${AVIA_WIZARD_LOG_PATH}/agave/"
chmod 644 -R "${AVIA_WIZARD_LOG_PATH}"

# AVIAINFRA-23 - Directory for YT-logs must be created beforehand
# so we dynamically took paths from push-client config and make sure of their existence.
cat /etc/yandex/statbox-push-client/files.yaml |
grep -oE 'name: .+' |
cut -d':' -f2- |
xargs -L1 dirname |
xargs mkdir -p
