Update Proxmox/pbs_logrotate.sh

This commit is contained in:
2025-01-26 08:48:52 +00:00
parent 582599ec2f
commit 95b402aa0c

View File

@@ -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