diff --git a/Proxmox/pbs_logrotate.sh b/Proxmox/pbs_logrotate.sh index 020e33e..7db4ac2 100644 --- a/Proxmox/pbs_logrotate.sh +++ b/Proxmox/pbs_logrotate.sh @@ -47,8 +47,8 @@ if [[ -n "$existing_cron" ]]; then fi # Preserve existing crontab and add the new job at the bottom -current_crontab=$(crontab -l 2>/dev/null) -echo -e "$current_crontab\n$cron_job" | awk 'NF' | uniq | sed '/^$/d' | { cat; echo "$cron_job"; } | crontab - +current_crontab=$(crontab -l 2>/dev/null | grep -vF "$cron_job") +echo -e "$current_crontab\n$cron_job" | sed '/^$/d' | crontab - # Check if the cron job was added successfully if [[ $? -eq 0 ]]; then @@ -61,4 +61,4 @@ else exit 1 fi -exit 0 +exit 0 \ No newline at end of file