Update Proxmox/pbs_logrotate.sh
This commit is contained in:
@@ -44,7 +44,7 @@ cron_job="0 3 * * * $cron_command"
|
||||
# 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")
|
||||
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
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user