scripts/xymon/tar.client.logfiles.sh

36 lines
833 B
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
# Purpose:
# Create an XZ archive of all files between 2 dates.
# Then remove these files
# Call this script from an /var/lib/xymon/hostdata subdirectory.
# Vars {{{
## Enable (0) or disable (1) debug
debug=0
## Manage files of year
date_year="2019"
## Compress files between these dates
date_start="${date_year}-01-01 00:00:01"
date_end="${date_year}-12-31 23:59:59"
## Best XZ compression level (= -9)
xz_compression_lvl="--best"
## Fatest XZ compression level (= -0)
#xz_compression_lvl="--fast"
## Get current directory name
current_dir=${PWD##*/}
## Archive name
tar_file_name="${date_year}.${current_dir}.tar.xz"
# }}}
[ "${debug}" -eq "0" ] && printf '%b' "Create an archive for ${current_dir} files between ${date_start} and ${date_end} using XZ's compression level: ${xz_compression_lvl}."
exit 0