From 86c7bf39e6bccd27c4f49c93714a396370e4289d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lesimple?= Date: Thu, 20 Jan 2022 15:48:15 +0000 Subject: [PATCH] remove compress-old-logs script, as osh-encrypt-rsync will do the job instead --- bin/admin/install | 5 ++++ bin/cron/osh-compress-old-logs.sh | 39 --------------------------- etc/cron.d/osh-compress-old-logs.dist | 2 -- 3 files changed, 5 insertions(+), 41 deletions(-) delete mode 100755 bin/cron/osh-compress-old-logs.sh delete mode 100644 etc/cron.d/osh-compress-old-logs.dist diff --git a/bin/admin/install b/bin/admin/install index 0bff967..c0a5940 100755 --- a/bin/admin/install +++ b/bin/admin/install @@ -431,6 +431,11 @@ if [ "$nothing" = 0 ]; then fi done + # remove deprecated cron files + if [ "${opt[cron]}" = 1 ]; then + rm -f "$CRON_DIR/osh-compress-old-logs" + fi + # ensure the includedir is present in global sudoers conf action_doing "Add include directory in sudoers if needed" if [ ! -e $SUDOERS_FILE ] ; then diff --git a/bin/cron/osh-compress-old-logs.sh b/bin/cron/osh-compress-old-logs.sh deleted file mode 100755 index e753f30..0000000 --- a/bin/cron/osh-compress-old-logs.sh +++ /dev/null @@ -1,39 +0,0 @@ -#! /usr/bin/env bash -# vim: set filetype=sh ts=4 sw=4 sts=4 et: - -basedir=$(readlink -f "$(dirname "$0")"/../..) -# shellcheck source=lib/shell/functions.inc -. "$basedir"/lib/shell/functions.inc - -LOG_FACILITY=local6 - -trap "_err 'Unexpected termination!'" EXIT - -_log "Compressing old sqlite databases..." - -while IFS= read -r -d '' sqlite -do - _log "Working on $sqlite..." - if ! gzip "$sqlite"; then - _log "Error while trying to compress $sqlite" - fi -done < <(find /home/ -mindepth 2 -maxdepth 2 -type f -name "*-log-??????.sqlite" -mtime +31 -print0) - -# also compress homedir logs that haven't been touched since 30 days, every day -while IFS= read -r -d '' log -do - _log "Working on $log..." - command -v chattr >/dev/null && chattr -a "$log" - if ! gzip "$log"; then - _log "Error while trying to compress $log" - fi -done < <(find /home/ -mindepth 2 -maxdepth 2 -type f -name "*-log-??????.log" -mtime +31 -print0) - -if command -v chattr >/dev/null; then - # then protect back all the logs - _log "Setting +a back on all the logs" - find /home/ -mindepth 2 -maxdepth 2 -type f -name "*-log-??????.log" -print0 | xargs -r0 chattr +a -- -fi - -_log "Done" -trap - EXIT diff --git a/etc/cron.d/osh-compress-old-logs.dist b/etc/cron.d/osh-compress-old-logs.dist deleted file mode 100644 index 904a994..0000000 --- a/etc/cron.d/osh-compress-old-logs.dist +++ /dev/null @@ -1,2 +0,0 @@ -# compress sqlite databases > 1 month along with log files -%RANDOM1%0:59% %RANDOM2%4:7% * * * root /opt/bastion/bin/cron/osh-compress-old-logs.sh >/dev/null