archive-logs

Iteratively archive newline separated log files

git clone https://git.8pit.net/archive-logs.git

 1compare_dirs() {
 2	diffout="$(diff -ur "${1}" "${2}")"
 3	if [ $? -ne 0 ]; then
 4		printf "FAIL: Directories differ.\n\n%s\n" "${diffout}"
 5		exit 1
 6	fi
 7}
 8
 9archive_logs() {
10	"${ARCHIVE_LOGS}" "$@" ./current ./archive
11	if [ $? -ne 0 ]; then
12		printf "FAIL: archive-logs failed\n"
13		exit 1
14	fi
15}
16
17check_dirs() {
18	compare_dirs current current-expected
19	compare_dirs archive archive-expected
20}
21
22run_test() {
23	archive_logs "$@"
24	check_dirs
25}