#!/bin/bash LOG_FILE="/data/logs/cron.log" mkdir -p $(dirname $LOG_FILE) #exec > $LOG_FILE 2>&1 exec > >(tee -a $LOG_FILE) 2>&1 if [ "$(id -u)" != "0" ]; then echo -e "\033[31mThis script requires superuser rights\033[0m" exit 0 fi trap 'echo -e "\033[31mcron.sh: Something went wrong\033[0m"; exit 1' ERR set -e export DEBIAN_FRONTEND=noninteractive cd /data/backup bash files-all.sh bash postgres-all.sh bash mariadb-all.sh trap - ERR echo "All cron tasks completed successfully"