35 lines
912 B
Bash
Executable file
35 lines
912 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# This script can be from cron to regularly verify that Ledger is
|
|
# sane. Such a cron entry might look like this, assuming you keep a
|
|
# recent working tree in ~/src/ledger, and that you want all of the
|
|
# temporary build products kept in /tmp:
|
|
#
|
|
# 0 0 * * * $HOME/src/ledger/run_verify.sh /tmp
|
|
#
|
|
# Note that this script should be run as root, otherwise it will be
|
|
# unable to clean up after itself (since make distcheck creates files
|
|
# owned by a different user). Also, whether on success or failure the
|
|
# build log and build products are left in the temporary directory for
|
|
# later examination if desired.
|
|
|
|
SRCDIR=$(dirname $0)
|
|
if [ -z "$SRCDIR" ]; then
|
|
SRCDIR=$(pwd)
|
|
fi
|
|
|
|
if [ -n "$1" -a -d "$1" ]; then
|
|
TMPDIR="$1"
|
|
else
|
|
TMPDIR=/tmp
|
|
fi
|
|
|
|
cd $TMPDIR || exit 1
|
|
|
|
cp -p "$SRCDIR"/verify.sh . || exit 1
|
|
|
|
(./verify.sh > verify.out 2>&1 || (cat verify.out; exit 1))
|
|
|
|
rm -f verify.sh
|
|
|
|
exit 0
|