# Koha Example Crontab File
-# Authors: Joe Atzberger <atz@liblime.com>
-# Joshua Ferraro <jmf@liblime.com>
+# 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, for example.
+# in other versions of crontab, like on Solaris 8 or BSD, for example.
#
-# While similar in strcture, this is NOT an example for cron (as
-# $USER). Cron takes an extra argument per line to designate the
-# user to run as. You could reasonably extrapoloate the needed
-# info from here though.
+# 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:
-# Standard Debian crontab settings
-SHELL=/bin/sh
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-
-# Establish Koha's two important ENV variables.
+# First, establish Koha's two important ENV variables.
-PERL5LIB=/home/liblime/kohaclone
-KOHA_CONF=/home/liblime/kohaclone/etc/koha-conf.xml
+PERL5LIB=/usr/share/koha/lib
+KOHA_CONF=/etc/koha/koha-conf.xml
# Some additional variables to save you typing
-KOHA_CRON_PATH = /home/liblime/kohaclone/misc/cronjobs
-KOHA_USER = koha
-NOTICE_EMAIL = your.email@your.domain
-
+KOHA_CRON_PATH = /usr/share/koha/bin/cronjobs
+#
# MULTIPLE KOHA SUPPORT:
-# You can still run jobs for this user's additional koha installs.
+# 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_CONF=/home/liblime/koha-test/etc/koha-conf.xml /home/liblime/kohaclone/misc/migration_tools/rebuild_zebra.pl -b -z >/dev/null
+# */10 * * * * 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_CONF=/home/liblime/koha-test/etc/koha-conf.xml PERL5LIB=/home/liblime/koha-test /home/liblime/koha-test/misc/migration_tools/rebuild_zebra.pl -b -z >/dev/null
+# */10 * * * * 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.
#
-# SCHEDULED JOBS:
-# Don't forget to keep the empty line at the bottom.
+# NOTE: Don't forget to keep the empty line at the bottom.
# Cron/crontab will choke without it.
#
-##### Cheat Sheet
-# min (0-59), hr (0-23), day of mo (1-31), mo of yr (1-12), day of wk (0-6 with 0=Sunday), command
-#
-# Examples:
-# every 10 minutes
-# */10 * * * *
-# every hour at 17 past
-# 17 * * * *
-
-# ZEBRA INDEX UPDATES with -z option, incremental index updates throughout the day
-# for both authorities and bibs
-*/10 * * * * $USER $KOHA_CRON_PATH/../misc/migration_tools/rebuild_zebra.pl -b -a -z >/dev/null
-
-# Hourly holds queue updated
-# runs every hour, on the hour
-01 * * * * $USER $KOHA_CRON_PATH/holds/build_holds_queue.pl
-# | mailx -s HoldsList $NOTICE_EMAIL
+# SCHEDULED JOBS:
+# m h dom mon dow command
# OVERDUE NOTICES
-# runs every morning at 6:01am
-01 6 * * * $USER $KOHA_CRON_PATH/overdue_notices.pl
+0 1 * * * $KOHA_CRON_PATH/overdue_notices.pl -t
-# ADVANCED NOTICES
-10 1 * * * $USER $KOHA_CRON_PATH/advance_notices.pl -c
+# FINES
+5 1 * * * $KOHA_CRON_PATH/fines.pl
-# SEND EMAILS
-# (run after overdue_notices.pl
-15 * * * * $USER $KOHA_CRON_PATH/process_message_queue.pl
+# ADVANCE NOTICES
+10 1 * * * $KOHA_CRON_PATH/advance_notices.pl -c
# PROCESS LONG OVERDUES
# updates item status from available to longoverdue for items long overdue
-# runs every night, right before fines.pl
-10 21 * * 1 $USER $KOHA_CRON_PATH/longoverdue.pl --lost 20=2 --lost 100=1 --charge 1 --confirm
+# 19 1 * * * $KOHA_CRON_PATH/longoverdue.pl --lost 90=1 --confirm
-# FINES
-# runs every night, right after longoverdue.pl
-10 22 * * 1 $USER $KOHA_CRON_PATH/longoverdue.pl
+# SEND EMAILS
+15 * * * * $KOHA_CRON_PATH/process_message_queue.pl
-## j2a -- updates juvennile patrons to adults
-# runs every night, right on time ;-)
-59 24 * * 1 $USER $KOHA_CRON_PATH/j2a.pl
+# Hourly holds queue updated
+52 * * * * $KOHA_CRON_PATH/holds/build_holds_queue.pl >/dev/null 2>&1
+
+# Cancel expired holds
+0 1 * * * $KOHA_CRON_PATH/holds/cancel_expired_holds.pl >/dev/null 2>&1
+
+# ZEBRA INDEX UPDATES with -z option, incremental index updates throughout the day
+# for both authorities and bibs
+*/10 * * * * $KOHA_CRON_PATH/../migration_tools/rebuild_zebra.pl -b -a -z >/dev/null
-## services_throttle -- resets the xISBN service
-# runs every night, right on time ;-)
-59 23 * * 1 $USER $KOHA_CRON_PATH/services_throttle.pl
+# services_throttle -- resets the xISBN service
+59 23 * * * $KOHA_CRON_PATH/services_throttle.pl > /dev/null 2>&1
-# backups -- backs up the system
-# runs every evening at 9:15
-15 21 * * * $USER $KOHA_CRON_PATH/backup.sh
+# clean up databases nightly. Be sure not to run this with --sessions during a time when the system is in use!
+16 1 * * * $KOHA_CRON_PATH/cleanup_database.pl --sessions --zebraqueue 10
+# delete old purchase suggestions weekly. Replace XX with a number to define the age of suggestions to delete.
+@weekly $KOHA_CRON_PATH/purge_suggestions.pl --days XX > /dev/null 2>&1