<commit_before>#!/bin/bash

# Managed by CFEngine

# This cronjob tars, compresses, and encrypts directories, then pushes them
# to AWS S3 - if:
#   1) aws CLI is configured for the EUID running the script; and
#   2) an encryption key file is found; and
#   3) a file containing directories to back up is found.
#
# To decrypt backed-up, encrypted tarballs, use:
#   openssl enc -aes128 -in $infile -out $outfile -d -a

# ------------------------------------------------------------------------- #
#			VARIABLE DEFINITIONS
# ------------------------------------------------------------------------- #

PATH=/usr/bin:/bin:/usr/local/bin

readonly _me="${0##*/}"
readonly _output="/tmp/${_me}.log"

readonly _key='/usr/local/etc/bkup-to-s3.key'
readonly _env='/usr/local/etc/bkup-to-s3.env'
readonly _bkup_list='/usr/local/etc/bkup-to-s3.list'

# ------------------------------------------------------------------------- #
#			FUNCTIONS
# ------------------------------------------------------------------------- #

errout() {
	local _msg="${_me} error: ${1}"

	printf '%s\n' "${_msg}"
	logger -p local3.err "${_msg}"

	exit 1
}

noticeout() {<commit_msg>Explicitly setting and exporting $HOME within the script. On some OSes, crontab or anacrontab are explicitly setting $HOME and screwing up the $HOME/.aws audit and the later 'aws s3' credential search.<commit_after>#!/bin/bash

# Managed by CFEngine

# This cronjob tars, compresses, and encrypts directories, then pushes them
# to AWS S3 - if:
#   1) aws CLI is configured for the EUID running the script; and
#   2) an encryption key file is found; and
#   3) a file containing directories to back up is found.
#
# To decrypt backed-up, encrypted tarballs, use:
#   openssl enc -aes128 -in $infile -out $outfile -d -a

# ------------------------------------------------------------------------- #
#			VARIABLE DEFINITIONS
# ------------------------------------------------------------------------- #

PATH=/usr/bin:/bin:/usr/local/bin

export HOME=/root

readonly _me="${0##*/}"
readonly _output="/tmp/${_me}.log"

readonly _key='/usr/local/etc/bkup-to-s3.key'
readonly _env='/usr/local/etc/bkup-to-s3.env'
readonly _bkup_list='/usr/local/etc/bkup-to-s3.list'

# ------------------------------------------------------------------------- #
#			FUNCTIONS
# ------------------------------------------------------------------------- #

errout() {
	local _msg="${_me} error: ${1}"

	printf '%s\n' "${_msg}"
	logger -p local3.err "${_msg}"

	exit 1
}

noticeout() {
{'fraction_non_alphanumeric': 0.3475149105367793, 'fraction_numerical': 0.011530815109343936, 'mean_word_length': 1.5134865134865134, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1089173', 'n_tokens_mistral': 795, 'n_tokens_neox': 729, 'n_words': 216}