From 21b64f79da33775f120245c6785e9a33cd443fbe Mon Sep 17 00:00:00 2001 From: hhftechnologies Date: Wed, 27 Nov 2024 16:03:30 +0530 Subject: [PATCH] update --- maintenance/crowdsec_removal.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/maintenance/crowdsec_removal.sh b/maintenance/crowdsec_removal.sh index 1a152ce..de3e7c7 100644 --- a/maintenance/crowdsec_removal.sh +++ b/maintenance/crowdsec_removal.sh @@ -82,11 +82,27 @@ interrupt_handler() { exit 130 } -# Cleanup function -cleanup() { +# Function to clean up temporary files +cleanup_files() { # Remove temporary files if they exist [ -f "/tmp/crowdsec_services.tmp" ] && rm -f "/tmp/crowdsec_services.tmp" [ -f "/tmp/crowdsec_packages.tmp" ] && rm -f "/tmp/crowdsec_packages.tmp" + return 0 +} + +# Function to remove the script +remove_script() { + if [ -f "$0" ]; then + rm -f -- "$0" + fi + if [ -f "task_formatter.sh" ]; then + rm -f task_formatter.sh + fi + return 0 +} + +# Main cleanup function +cleanup() { format_output cleanup_files "Cleaning up temporary files" format_output remove_script "Removing script" }