feat: Migrate to system-specific crontab files with enhanced logging and management

This commit is contained in:
Peter Wood
2025-05-26 12:10:15 -04:00
parent b016f4e241
commit e6aec6dd5d
9 changed files with 70 additions and 44 deletions

View File

@@ -15,7 +15,7 @@ NC='\033[0m' # No Color
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
HOSTNAME=$(hostname)
ENHANCED_CRONTAB_FILE="$SCRIPT_DIR/enhanced-crontab-${HOSTNAME}.txt"
ENHANCED_CRONTAB_FILE="$SCRIPT_DIR/crontab-${HOSTNAME}.txt"
BACKUP_CRONTAB_FILE="/tmp/crontab-backup-$(date +%Y%m%d_%H%M%S)"
log_message() {
@@ -54,17 +54,10 @@ install_enhanced_crontab() {
if [ ! -f "$ENHANCED_CRONTAB_FILE" ]; then
log_warning "System-specific crontab file not found: $ENHANCED_CRONTAB_FILE"
log_info "Available crontab files:"
ls -la "$SCRIPT_DIR"/enhanced-crontab-*.txt 2>/dev/null || log_warning "No system-specific crontab files found"
ls -la "$SCRIPT_DIR"/crontab-*.txt 2>/dev/null || log_warning "No system-specific crontab files found"
# Check for generic fallback
FALLBACK_CRONTAB="$SCRIPT_DIR/enhanced-crontab.txt"
if [ -f "$FALLBACK_CRONTAB" ]; then
log_info "Using generic fallback crontab: $FALLBACK_CRONTAB"
ENHANCED_CRONTAB_FILE="$FALLBACK_CRONTAB"
else
log_error "No suitable crontab file found. Please create $ENHANCED_CRONTAB_FILE or $FALLBACK_CRONTAB"
return 1
fi
log_error "No suitable crontab file found. Please create $ENHANCED_CRONTAB_FILE"
return 1
fi
# Create a backup before making changes