#!/bin/sh -e
#
# $Id: hearse.cron.daily,v 1.2 2002-06-04 03:10:10 roderick Exp $

# The standard Debian and RPM installations run hearse once a day.  The
# program itself works well when run more frequently (if it doesn't find
# any new bones files it doesn't even contact the server).  If you'd
# like to do that you could uncommont the following "exit" command and
# edit /etc/cron.d/hearse according to the comments in it.
#
#exit 0

# If you'd like to see what the server's doing, you can use --cron rather
# than --quiet.  This will cause it to output its status messages, but
# only when it actually transfers a bones file.

hearse_args=--quiet
#hearse_args=--cron
#hearse_args=--debug

# Bail if the package has been removed but not purged.

[ -f /usr/bin/hearse ] || exit 0

# Bail if there's no user token.

[ -s /etc/nethack/hearse.user-token ] || exit 0

# Add a bit of randomization to help prevent the server from getting
# hammered at the top of each time zone's cron.daily hour.

(
    perl -we 'sleep rand 1800'
    hearse $hearse_args
) &
