From dd8546c1b3c01f469d32365ab332989a91b1d36f Mon Sep 17 00:00:00 2001 From: th33xitus Date: Mon, 31 Oct 2022 15:59:10 +0100 Subject: [PATCH] refactor(obico): update log remove Signed-off-by: Dominik Willner --- scripts/obico.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/obico.sh b/scripts/obico.sh index 5b643bc..79eb2c6 100644 --- a/scripts/obico.sh +++ b/scripts/obico.sh @@ -315,8 +315,21 @@ function remove_moonraker_obico_systemd() { } function remove_moonraker_obico_logs() { + local files regex="\/home\/${USER}\/([A-Za-z0-9_]+)\/logs\/moonraker-obico(-[0-9a-zA-Z]+)?\.log(.*)?" + files=$(find "${HOME}" -maxdepth 3 -regextype posix-extended -regex "${regex}" | sort) + + if [[ -n ${files} ]]; then + for file in ${files}; do + status_msg "Removing ${file} ..." + rm -f "${file}" + ok_msg "${file} removed!" + done + fi +} + +function remove_legacy_moonraker_obico_logs() { local files regex="moonraker-obico(-[0-9a-zA-Z]+)?\.log(.*)?" - files=$(find "${KLIPPER_LOGS}" -maxdepth 1 -regextype posix-extended -regex "${KLIPPER_LOGS}/${regex}" 2> /dev/null | sort) + files=$(find "${HOME}/klipper_logs" -maxdepth 1 -regextype posix-extended -regex "${HOME}/klipper_logs/${regex}" 2> /dev/null | sort) if [[ -n ${files} ]]; then for file in ${files}; do