3 #=======================================================================
5 # File ID: 7bd794f8-5551-11e0-942f-b7ae6f27caa2
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #=======================================================================
25 " -n "$progname" -- "$@
")"
26 test "$?" = "0" ||
exit 1
34 -h|
--help) opt_help
=1; shift ;;
35 -q|
--quiet) opt_quiet
=$
(($opt_quiet + 1)); shift ;;
36 -v|
--verbose) opt_verbose
=$
(($opt_verbose + 1)); shift ;;
37 --version) echo $progname $VERSION; exit 0 ;;
39 *) echo $progname: Internal error
>&2; exit 1 ;;
42 opt_verbose
=$
(($opt_verbose - $opt_quiet))
44 if test "$opt_help" = "1"; then
45 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
50 Usage: $progname [options]
57 Be more quiet. Can be repeated to increase silence.
59 Increase level of verbosity. Can be repeated.
61 Print version information.
67 lockdir
=~
/.pakk_log.lock
69 echo $progname: $lockdir: Cannot create lockdir
>&2
75 echo "$progname: $*" >&2
80 echo $progname: $lockdir: Cannot remove lockdir
>&2
85 trap "myexit 1" INT TERM
88 sha1sum "$1" |
head -c 40
94 local orig_sha
=$
(get_sha1
"$dflog")
100 while test "$orig_sha" != "$new_sha"; do
101 if test "$have_tried" = "1"; then
102 echo $progname: $dflog has changed
, retrying copy
>&2
103 orig_sha
=$
(get_sha1
"$dflog")
106 rsync
-avP --inplace "$dflog" "$dfdestfile"
107 new_sha
=$
(get_sha1
"$dflog")
111 dest_sha
=$
(get_sha1
"$dfdestfile")
112 if test "$dest_sha" != "$orig_sha"; then
113 echo $progname: SHA1 checksum
for $dest_sha does not match
>&2
121 annexdir
="$HOME/annex/log"
122 dfdestdir
="$annexdir/df/$hname"
123 dfdestfile
="$dfdestdir/df.sqlite"
124 dflog
="$HOME/log/df.sqlite"
126 cd "$annexdir" ||
{ echo $progname: $annexdir: chdir error
>&2; exit 1; }
130 if test -f "$dflog"; then
131 mkdir
-p "$dfdestdir"
133 echo $progname: $dfdestdir: chdir error
>&2
136 if test -n "$(git status --porcelain df.sqlite)"; then
137 echo $progname: $dfdestfile is modified
>&2
143 copy_df_log
"$dflog" "$dfdestfile" || myexit
1
146 msg Packing \~
/log
/script
/
148 echo $progname: ~
/log
/script: Unable to chdir
>&2
151 find -type f |
grep -E '\.(scrlog|timing)$' |
while read f
; do
152 uuid
=$
(echo "$f" | finduuid
)
153 ps auxw |
grep -v "grep $uuid" |
grep $uuid |
grep -q . ||
gzip -Nv "$f"
158 # Disabled, pack the irc logs manually for now
162 if test -d "$ircdir/."; then
164 cd "$ircdir" ||
{ echo $progname: $ircdir: Unable to chdir
>&2; exit 1; }
165 currdate
=`date +"%Y-%m-%d"`
166 find -type f
-name '*.log' -print0 |
grep -vz "$currdate" |