[josm-dev] no latest built for 5 days

Ævar Arnfjörð Bjarmason avarab at gmail.com
Fri Aug 13 21:44:50 BST 2010


On Fri, Aug 13, 2010 at 18:27, Dirk Stöcker <openstreetmap at dstoecker.de> wrote:
> On Fri, 13 Aug 2010, Ævar Arnfjörð Bjarmason wrote:
>
>> What sort of automated job is it? If it's in cron you can easily make
>> cron send you an E-Mail on error.
>
> It is a cronjob, but normally it is too noisy, so all outputs go to
> /dev/null. It is not so easy to get cronjobs to only produce ouput when
> something fails.

It is actually, just install this: http://search.cpan.org/dist/App-Cronjob/

Then put something like this in your crontab:

    @daily cronjob -E -j josm-build -E /path/to/build.sh

cronjob(1) will consume all the output, and either print it all or
nothing, depending on the exit code of the program it's running.

If you're running a POSIX shell script you can add this to the top of
the script:

    # Exit on errors
    trap 'fail' ERR
    fail () {
        code=$?
        echo "Failed with exit code $code"
        exit 1
    }

Then you don't have to check the exit code of everything individually.

I use this for all my cronjobs, see
e.g. http://github.com/avar/openstreetmap-mirror for an example, it's
what I use to get E-Mails when the JOSM GitHub mirror fails, but
*only* when it fails.



More information about the josm-dev mailing list