archive-logs

Iteratively archive newline separated log files

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

 1#!/bin/sh
 2. "${0%/*}/common.sh"
 3
 4cat >current/file1 <<-EOF
 5	fooooobaaarr
 6	foobar
 7EOF
 8
 9cat >current/file2 <<-EOF
10	test123
11	barfoooooooo
12EOF
13cat >current/file3 <<-EOF
14	1
15	2
16EOF
17chmod -w current/file2 current/file3
18
19cat >current-expected/file1 <<-EOF
20	foobar
21EOF
22
23cat >archive-expected/file1 <<-EOF
24	fooooobaaarr
25EOF
26
27archive_logs -e "file[2-3]"
28rm current/file2 current/file3 </dev/null
29check_dirs