From 405a766b0ed8f72b1bce599b444f58981e213f93 Mon Sep 17 00:00:00 2001 From: ohmer1 <1868995+ohmer1@users.noreply.github.com> Date: Tue, 20 Jun 2023 10:30:17 -0400 Subject: [PATCH 1/2] Render logging of manual delete cron job optional --- defaults/main.yml | 1 + tasks/7_1_manual_delete.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index d9a1eba..468db14 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -5,6 +5,7 @@ ### Modules --- # Configure Burp manual delete burp_manual_delete_enabled: true +burp_manual_delete_logs: true # Configure Burp Autoupgrade burp_server_autoupgrade_enabled: true # Activate clients from git repository diff --git a/tasks/7_1_manual_delete.yml b/tasks/7_1_manual_delete.yml index 5bbe130..a91fd3a 100644 --- a/tasks/7_1_manual_delete.yml +++ b/tasks/7_1_manual_delete.yml @@ -25,7 +25,7 @@ - name: manual_delete | Cron task to delete files in burp trash cron: name: delete files in burp trash - job: 'rm -rfv {{ burp_trash }}/* >> {{ burp_logs }}/manual_delete.log' + job: 'rm -rfv {{ burp_trash }}/* >> {% if burp_manual_delete_logs %}{{ burp_logs }}/manual_delete.log{% else %}/dev/null {% endif %}' user: root cron_file: manual_delete minute: "{{ item.minute }}" From 334500b645a09001938adb93fae1ba915206a171 Mon Sep 17 00:00:00 2001 From: ohmer1 <1868995+ohmer1@users.noreply.github.com> Date: Wed, 23 Aug 2023 11:30:48 -0400 Subject: [PATCH 2/2] Avoid concurrent run of rm with the use of flock utility --- tasks/7_1_manual_delete.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/7_1_manual_delete.yml b/tasks/7_1_manual_delete.yml index a91fd3a..334ec64 100644 --- a/tasks/7_1_manual_delete.yml +++ b/tasks/7_1_manual_delete.yml @@ -25,7 +25,7 @@ - name: manual_delete | Cron task to delete files in burp trash cron: name: delete files in burp trash - job: 'rm -rfv {{ burp_trash }}/* >> {% if burp_manual_delete_logs %}{{ burp_logs }}/manual_delete.log{% else %}/dev/null {% endif %}' + job: 'flock --exclusive {{ burp_trash }} --command "rm -rfv {{ burp_trash }}/*" >> {% if burp_manual_delete_logs %}{{ burp_logs }}/manual_delete.log{% else %}/dev/null {% endif %}' user: root cron_file: manual_delete minute: "{{ item.minute }}"