summaryrefslogtreecommitdiff
path: root/run_verify.sh
blob: 236a9e6778a3ee593e673b908c76b41ee7fd2af5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/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
#
# On both success and 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