Update Proxmox/pbs_logrotate.sh
This commit is contained in:
@@ -47,8 +47,8 @@ if [[ -n "$existing_cron" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Preserve existing crontab and add the new job at the bottom
|
# Preserve existing crontab and add the new job at the bottom
|
||||||
current_crontab=$(crontab -l 2>/dev/null)
|
current_crontab=$(crontab -l 2>/dev/null | grep -vF "$cron_job")
|
||||||
echo -e "$current_crontab\n$cron_job" | awk 'NF' | uniq | sed '/^$/d' | { cat; echo "$cron_job"; } | crontab -
|
echo -e "$current_crontab\n$cron_job" | sed '/^$/d' | crontab -
|
||||||
|
|
||||||
# Check if the cron job was added successfully
|
# Check if the cron job was added successfully
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user