22 lines
896 B
Bash
22 lines
896 B
Bash
#!/bin/bash
|
|
|
|
# Script to check for scheduled cron jobs for /home/litespeed/mb-backups/backup_all.sh
|
|
|
|
# Define the script path to check in cron jobs
|
|
SCRIPT_PATH="/home/litespeed/mb-backups/backup_all.sh"
|
|
LOG_FILE="/home/litespeed/mb-backups/logs/cron_check.log"
|
|
|
|
# Log the start of the script check
|
|
echo "[$(date)] Checking for automated backup cron job..." | tee -a "$LOG_FILE"
|
|
|
|
# Check if the cron job is found in the crontab
|
|
CRON_JOB=$(crontab -l | grep -F "$SCRIPT_PATH")
|
|
|
|
if [ -z "$CRON_JOB" ]; then
|
|
echo "[$(date)] Automated Backups are NOT enabled." | tee -a "$LOG_FILE"
|
|
else
|
|
echo "[$(date)] Automated Backups are enabled with the following schedule:" | tee -a "$LOG_FILE"
|
|
echo "$CRON_JOB" | awk '{print "Schedule: " $1, $2, $3, $4, $5}' | tee -a "$LOG_FILE"
|
|
echo "[$(date)] Note: Computing the next human-readable run time requires external tools." | tee -a "$LOG_FILE"
|
|
fi
|