Koha/misc/cronjobs/crontab.example
Katrin Fischer 596ddef3c3 Bug 11144: Fix sequence of cronjobs: automatic renewal - fines - overdue notices
The patch changes the sequence of cronjobs in the crontab example
file and in the cron.daily file of the packages.

This is why:
1) Renew automatically
   ... only when we can't renew, we want to
2) Calculate fines
   ... once the fine are calculated and charged
   we can print the amount into the
3) Overdue notices

Before the change it could happen that you'd charge for an item,
that would then be renewed. Or that you'd try to print fine
amounts into the overdue notices, when they would only be
charged moments later.

To test:
- configure your system so you have items that should
  - be charged with fines
  - renew automatically
- configure your crontabs according to the example file
  or switch the cron.daily in your package installation with
  the new one
- configure your overdue notices so that one should be generated
  <<items.fine>>
- Wait for the cronjobs or schedule them to run earlier
- Verify all is well and as it should be

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-09-02 13:51:32 +00:00

93 lines
4 KiB
Text

# Koha Example Crontab File
# Author: Joe Atzberger <atz@liblime.com>
#
# This is an example of a crontab file for Debian. It may not work
# in other versions of crontab, like on Solaris 8 or BSD, for example.
#
# While similar in structure,
# this is NOT an example for cron (as root). Cron takes an extra
# argument per line to designate the user to run as. You could
# reasonably extrapolate the needed info from here though.
#
# WARNING: These jobs will do things like charge fines, send
# potentially VERY MANY emails to patrons and even debar offending
# users. DO NOT RUN OR SCHEDULE these jobs without being sure you
# really intend to. Make sure the relevant message templates are
# configured to your liking before scheduling messages to be sent.
#
# ENVIRONMENT:
# First, establish Koha's two important ENV variables.
PERL5LIB=/usr/share/koha/lib
KOHA_CONF=/etc/koha/koha-conf.xml
# Some additional variables to save you typing
KOHA_CRON_PATH = /usr/share/koha/bin/cronjobs
#
# MULTIPLE KOHA SUPPORT:
# You can still run jobs for this user's additional koha installs,
# by manipulating those variables in the command.
#
# For example, on the same codebase:
# */10 * * * * __KOHA_USER__ KOHA_CONF=/etc/koha/koha-conf.xml /usr/share/koha/bin/migration_tools/rebuild_zebra.pl -b -a -z >/dev/null
#
# For example, on a separate codebase:
# */10 * * * * __KOHA_USER__ KOHA_CONF=/etc/koha/koha-conf.xml PERL5LIB=/home/koha/kohaclone /home/koha/kohaclone/misc/migration_tools/rebuild_zebra.pl -b -a -z >/dev/null
#
# ADDITIONAL INFO:
# See the perldoc of individual scripts to determine what other options
# are available. Check the man page for crontab to understand the
# schedule syntax for your system.
#
# NOTE: Don't forget to keep the empty line at the bottom.
# Cron/crontab will choke without it.
#
# SCHEDULED JOBS:
# m h dom mon dow user command
# AUTOMATIC RENEWAL + FINES + OVERDUE NOTICES
# Sequence is important - renew what can be renewed, charge fines for the rest, print fine amount into overdue notices
5 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/automatic_renewals.pl && $KOHA_CRON_PATH/fines.pl && $KOHA_CRON_PATH/overdue_notices.pl -t
# ADVANCE NOTICES
10 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/advance_notices.pl -c
# MEMBERSHIP_EXPIRY NOTICES
15 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/membership_expiry.pl -c
# PROCESS LONG OVERDUES
# updates item status from available to longoverdue for items long overdue
# 19 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/longoverdue.pl --lost 90=1 --confirm
# SEND EMAILS
15 * * * * __KOHA_USER__ $KOHA_CRON_PATH/process_message_queue.pl
# Hourly holds queue updated
52 * * * * __KOHA_USER__ $KOHA_CRON_PATH/holds/build_holds_queue.pl >/dev/null 2>&1
# Cancel expired holds
0 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/holds/cancel_expired_holds.pl >/dev/null 2>&1
# Auto unsuspend holds
0 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/holds/auto_unsuspend_holds.pl > /dev/null 2>&1
# Update popularity counts for biblio records
0 2 * * * __KOHA_USER__ $KOHA_CRON_PATH/update_totalissues.pl --commit=1000 --use-stats --incremental --interval=1d >/dev/null 2>&1
# ZEBRA INDEX UPDATES with -z option, incremental index updates throughout the day
# for both authorities and bibs
*/10 * * * * __KOHA_USER__ $KOHA_CRON_PATH/../migration_tools/rebuild_zebra.pl -b -a -z >/dev/null
# services_throttle -- resets the xISBN service
59 23 * * * __KOHA_USER__ $KOHA_CRON_PATH/services_throttle.pl > /dev/null 2>&1
# clean up databases nightly. Be sure not to run this with --sessions during a time when the system is in use!
16 1 * * * __KOHA_USER__ $KOHA_CRON_PATH/cleanup_database.pl --sessions --zebraqueue 10 --list-invites
# delete old purchase suggestions weekly. Replace XX with a number to define the age of suggestions to delete.
@weekly __KOHA_USER__ $KOHA_CRON_PATH/purge_suggestions.pl --days XX > /dev/null 2>&1
# share_usage_with_koha_community.pl every months
0 0 1 * * __KOHA_USER__ $KOHA_CRON_PATH/share_usage_with_koha_community.pl