Update Proxmox/pbs_logrotate.sh

This commit is contained in:
2025-01-26 08:53:48 +00:00
parent 23a5e5eb5a
commit 71407eb207

View File

@@ -44,7 +44,7 @@ cron_job="0 3 * * * $cron_command"
# Check if a similar cron job exists with a different number of days # Check if a similar cron job exists with a different number of days
existing_cron=$(crontab -l 2>/dev/null | grep -F "$cron_command_base") existing_cron=$(crontab -l 2>/dev/null | grep -F "$cron_command_base")
if [[ -n "$existing_cron" ]]; then if [[ -n "$existing_cron" ]]; then
existing_days=$(echo "$existing_cron" | grep -oP "\+\d+" | tr -d '+') existing_days=$(echo "$existing_cron" | grep -oP "\+\d+" | head -n 1 | tr -d '+')
if [[ "$existing_days" != "$days_to_keep" ]]; then if [[ "$existing_days" != "$days_to_keep" ]]; then
color_echo "33" "A cron job already exists with $existing_days days." color_echo "33" "A cron job already exists with $existing_days days."
read -p "Do you want to update it to $days_to_keep days? (y/n): " update_confirm read -p "Do you want to update it to $days_to_keep days? (y/n): " update_confirm