manager/helpers/logrotate/generate-logrotate-config
Dan Anglin 0feb20c906
feat: setup logrotate for the $XDG_STATE_HOME/logs
- Add logrotate config for the new $XDG_STATE_HOME/logs directory.
- Run logrotate before starting DWM (logs are rotated if required by the
  configuration).
2022-05-22 10:47:31 +01:00

14 lines
494 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
GIT_ROOT_DIR="$( cd "$( dirname $0 )/../.." && pwd )"
LF_DOTFILES_SOURCE_DIR="${GIT_ROOT_DIR}/config/logrotate"
LF_DOTFILES_DESTINATION_DIR="${XDG_CONFIG_HOME}/logrotate"
if ! [ -d ${LF_DOTFILES_DESTINATION_DIR} ]; then
echo "INFO: Creating directory ${LF_DOTFILES_DESTINATION_DIR}"
mkdir ${LF_DOTFILES_DESTINATION_DIR}
fi
rsync -avh ${LF_DOTFILES_SOURCE_DIR}/logrotate.conf ${LF_DOTFILES_DESTINATION_DIR}/logrotate.conf && chmod a-rwx,u+rw $_