mirror of
https://github.com/ovh/the-bastion.git
synced 2025-02-27 00:54:26 +08:00
remove compress-old-logs script, as osh-encrypt-rsync will do the job instead
This commit is contained in:
parent
6baa61a7f4
commit
86c7bf39e6
3 changed files with 5 additions and 41 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in a new issue