2024-08-14 10:49:54 +05:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-08-20 09:47:49 +05:00
|
|
|
LOG_FILE="/data/logs/cron.log"
|
2024-08-20 10:31:39 +05:00
|
|
|
mkdir -p $(dirname $LOG_FILE)
|
2024-08-20 13:03:39 +05:00
|
|
|
#exec > $LOG_FILE 2>&1
|
|
|
|
exec > >(tee -a $LOG_FILE) 2>&1
|
2024-08-20 09:47:49 +05:00
|
|
|
|
2024-08-14 10:49:54 +05:00
|
|
|
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"
|