1 .. include:: images.rst
7 A cron job is a Linux command for scheduling a command or script on your
8 server to complete repetitive tasks automatically. Scripts executed as a
9 cron job are typically used to modify files or databases; however, they
10 can perform other tasks that do not modify data on the server, like
11 sending out email notifications. Koha has many cron jobs in place that
12 you can enable (search engine indexing, overdue notice generation, data
13 cleanup and more), this chapter will explain those for you.
16 -------------------------
18 An example of a Koha crontab can be found in misc/cronjobs/crontab.example
20 The example includes sample boilerplate cronjob entries for the most
21 commonly-used cronjobs.
23 .. _cron-jobs-subchapter-label:
26 -------------------------
28 The locations below assume a dev install which puts the crons in misc/,
29 if you have a standard install you may want to look in bin/ for these
30 files if you cannot find them in misc/
32 .. _daily-backup-label:
35 ~~~~~~~~~~~~~~~~~~~~~~~~
38 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
40 Script path: misc/cronjobs/backup.sh
42 Does: Creates a daily backup of the Koha database.
44 Frequency suggestion: daily
49 ~~~~~~~~~~~~~~~~~~~~~~~~
51 .. _rebuild-index-label:
54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56 Script path: misc/migration\_tools/rebuild\_zebra.pl
58 Does: Updates Zebra indexes with recently changed data.
62 Frequency suggestion: every x minutes, (between 5-15 minutes) depending
65 .. _circulation-label:
68 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
70 .. _holds-queue-label:
73 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
75 Script path: misc/cronjobs/holds/build\_holds\_queue.pl
77 Does: Updates holds queue report
79 Required by: :ref:`Holds Queue Report <holds-queue-label>`
81 Frequency suggestion: every 1-4 hours
85 - A script that should be run periodically if your library system
86 allows borrowers to place on-shelf holds. This script decides which
87 library should be responsible for fulfilling a given hold request.
89 It's behavior is controlled by the system preferences
90 :ref:`StaticHoldsQueueWeight <staticholdsqueueweight,-holdsqueueskipclosed-&-randomizeholdsqueueweight-label>` and
91 :ref:`RandomizeHoldsQueueWeight <staticholdsqueueweight,-holdsqueueskipclosed-&-randomizeholdsqueueweight-label>`.
93 If you do not want all of your libraries to participate in the
94 on-shelf holds fulfillment process, you should list the the libraries
95 that \*do\* participate in the process here by inputting all the
96 participating library's branchcodes, separated by commas ( e.g.
97 "MPL,CPL,SPL,BML" etc. ).
99 By default, the holds queue will be generated such that the system
100 will first attempt to hold fulfillment using items already at the
101 pickup library if possible. If there are no items available at the
102 pickup library to fill a hold, build\_holds\_queue.pl will then use
103 the list of libraries defined in StaticHoldsQueueWeight. If
104 RandomizeHoldsQueueWeight is disabled ( which it is by default ), the
105 script will assign fulfillment requests in the order the branches are
106 placed in the StaticHoldsQueueWeight system preference.
108 For example, if your system has three libraries, of varying sizes (
109 small, medium and large ) and you want the burden of holds
110 fulfillment to be on larger libraries before smaller libraries, you
111 would want StaticHoldsQueueWeight to look something like
114 If you want the burden of holds fulfillment to be spread out equally
115 throughout your library system, simply enable
116 RandomizeHoldsQueueWeight. When this system preference is enabled,
117 the order in which libraries will be requested to fulfill an on-shelf
118 hold will be randomized each time the list is regenerated.
120 Leaving StaticHoldsQueueWeight empty is contraindicated at this time.
121 Doing so will cause the build\_holds\_queue script to ignore
122 RandomizeHoldsQueueWeight, causing the script to request hold
123 fulfillment not randomly, but by alphabetical order.
125 .. _expired-holds-label:
128 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
130 Script path: misc/cronjobs/holds/cancel\_expired\_holds.pl
132 Does: By default, this cron job will only automatically cancel holds
133 where the user has set an expiration date. If the library is using the
134 :ref:`ExpireReservesMaxPickUpDelay` and
135 :ref:`ExpireReservesMaxPickUpDelayCharge`
136 preferences then this script will also cancel holds that have been
137 sitting on the hold shelf for too long and will (if the library does)
138 charge the patron for not picking up the hold.
140 Frequency suggestion: daily
142 .. _unsuspend-holds-label:
145 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
147 Script path: misc/cronjobs/holds/auto\_unsuspend\_holds.pl
149 Does: This script checks to find holds that should no longer be
150 suspended and removes the suspension if the
151 :ref:`AutoResumeSuspendedHolds` preference is
152 set to 'allow'. This puts the patron back in to the queue where they
153 were when the hold was suspended.
155 Frequency suggestion: daily
160 ^^^^^^^^^^^^^^^^^^^^^^^^^
162 Script path: misc/cronjobs/fines.pl
164 Does: Calculates and posts fines to patron accounts.
166 Required by: :ref:`finesMode` system preference
168 Frequency suggestion: nightly
170 .. _long-overdues-label:
173 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
175 Script path: misc/cronjobs/longoverdue.pl
177 Does: allows one to specify delays for changing items to different lost
178 statuses, and optionally charge for them using the replacement price
179 listed on the item record.
181 Frequency suggestion: nightly
185 Staff can control some of the parameters for the longoverdue cron
187 :ref:`DefaultLongOverdueLostValue <defaultlongoverduelostvalue-&-defaultlongoverduedays-label>` and
188 :ref:`DefaultLongOverdueChargeValue`
191 .. _track-total-checkouts-label:
193 Track Total Checkouts
194 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
196 Script path: misc/cronjobs/update\_totalissues.pl
198 Does: updates the biblioitems.totalissues field in the database with the
199 latest tally of checkouts based on historical issue statistics.
201 Frequency suggestion: nightly
205 If the time on your database server does not match the time on your Koha
206 server you will need to take that into account, and probably use the
207 --since argument instead of the --interval argument for incremental
212 This cronjob can be used if there is a performance concern. Otherwise,
213 use the UpdateTotalIssuesOnCirc System Preference.
215 .. _generate-patron-file-for-offline-circulation-label:
217 Generate Patron File for Offline Circulation
218 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
220 Script path: misc/cronjobs/create\_koc\_db.pl
222 Does: Generates the borrowers.db file for use with the :ref:`Koha Offline
223 Circulation <offline-circ-tool-for-windows-label>` tool
225 Frequency suggestion: weekly
227 .. _automatic-renewal-label:
230 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
232 Script path: misc/cronjobs/automatic\_renewals.pl
234 Does: Will automatically renew items if you're allowing automatic
235 renewal with your :ref:`circulation and fine rules <circulation-and-fine-rules-label>`.
237 Frequency suggestion: nightly
242 ~~~~~~~~~~~~~~~~~~~~~~~~~~
244 .. _unverified-registrations-label:
246 Unverified Registrations
247 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
249 Script path: misc/cronjobs/delete\_expired\_opac\_registrations.pl
251 Does: Deletes patron registrations that were submitted via the OPAC but
252 not reviewed by the library within the number of days entered in the
253 :ref:`PatronSelfRegistrationExpireTemporaryAccountsDelay`
256 Frequency suggestion: nightly
258 .. _unconfirmed-registrations-label:
260 Unconfirmed Registrations
261 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
263 Script path: misc/cronjobs/delete\_unverified\_opac\_registrations.pl
265 Does: Deletes patron self registrations that were submitted via the OPAC
266 but not confirmed via email within 24 hours. This is only necessary if
267 you are requiring patrons to confirm their registrations via email with
269 :ref:`PatronSelfRegistrationVerifyByEmail`
272 Frequency suggestion: hourly
274 .. _anonymize-patron-data-label:
276 Anonymize Patron Data
277 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
279 Script path: misc/cronjobs/batch\_anonymise.pl
281 Does: Used to anonymize patron data. This will remove borrowernumbers
282 from circulation history so that the stats are kept, but the patron
283 information is removed for privacy reasons.
285 .. _update-child-to-adult-patron-type-label:
287 Update Child to Adult Patron Type
288 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
290 Script path: misc/cronjobs/j2a.pl
292 Does: Convert juvenile/child patrons from juvenile patron category and
293 category code to corresponding adult patron category and category code
294 when they reach the upper age limit defined in the Patron Categories.
296 Frequency suggestion: nightly
300 This script is designed to update patrons from juvenile to adult patron
301 types, remove the guarantor, and update their category codes
302 appropriately when they reach the upper age limit defined in the Patron
309 "juv2adult.pl" -b=<branchcode> -f=<categorycode> -t=<categorycode>
310 (Processes a single branch, and updates the patron categories from
311 category to category)
313 "juv2adult.pl" -f=<categorycode> -t=<categorycode> -v -n (Processes all
314 branches, shows all messages, and reports the patrons who would be
315 affected. Takes no action on the database)
320 ~~~~~~~~~~~~~~~~~~~~~~~~~~
322 .. _message-queue-label:
325 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
327 Script path: misc/cronjobs/process\_message\_queue.pl
329 Does: processes the message queue to send the check out, check in and
330 hold filled emails and SMS message to users and sends outgoing emails to
332 :ref:`EnhancedMessagingPreferences` to be
335 Frequency suggestion: 1-4 hours
339 Item due and Advanced due notices are controlled by the
340 :ref:`advance\_notices cron <advanced-notice-label>`.
342 .. _advanced-notice-label:
345 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
347 Script path: misc/cronjobs/advance\_notices.pl
349 Does: prepares "pre-due" notices and "item due" notices for patrons who
350 request them prepares notices for patrons for items just due or coming
352 :ref:`EnhancedMessagingPreferences` to be
355 Frequency suggestion: nightly
359 This script does not actually send the notices. It queues them in
360 the :ref:`message queue <message-queue-label>` for later
362 .. _overdue-notice-label:
365 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
367 Script path: misc/cronjobs/overdue\_notices.pl
369 Does: prepares messages to alert patrons of overdue messages (both via
372 Frequency suggestion: nightly
376 This script does not actually send the notices. It queues them in
377 the :ref:`message queue <message-queue-label>` for later or generates the
378 HTML for later printing
382 The misc/cronjobs/advance\_notices.pl program allows you to send
383 messages to patrons in advance of their items becoming due, or to alert
384 them of items that have just become due.
386 .. _print-hold-notices-label:
389 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
391 Script path: misc/cronjobs/gather\_print\_notices.pl
393 Does: looks through the message queue for hold notices that didn't go
394 through because the patron didn't have an email address and generates a
397 Frequency suggestion: nightly
399 .. _talking-tech-label:
402 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
404 To learn more about setting up this third party product view the
405 `Talking Tech Appendix <#talkingtechappendix>`__.
407 .. _sending-notices-file-label:
410 '''''''''''''''''''''''''''''''''''''''''''''''
412 Script path: misc/cronjobs/thirdparty/TalkingTech\_itiva\_outbound.pl
414 Does: Script to generate Spec C outbound notifications file for Talking
415 Tech i-tiva phone notification system.
418 :ref:`TalkingTechItivaPhoneNotification`
420 Frequency suggestion: nightly
422 .. _receiving-notices-file-label:
424 Receiving Notices File
425 ''''''''''''''''''''''''''''''''''''''''''''''''''''
427 Script path: misc/cronjobs/thirdparty/TalkingTech\_itiva\_inbound.pl
429 Does: Script to process received Results files for Talking Tech i-tiva
430 phone notification system.
433 :ref:`TalkingTechItivaPhoneNotification`
435 Frequency suggestion: nightly
437 .. _notify-patrons-of-expiration-label:
439 Notify Patrons of Expiration
440 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
442 Script path: misc/cronjobs/membership\_expiry.pl
444 Does: Sends messages to warn patrons of their card expiration to the
445 :ref:`messaage queue <message-queue-label>` cron.
447 Requires: :ref:`MembershipExpiryDaysNotice`
451 .. _in-processing/book-cart-label:
453 In Processing/Book Cart
454 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
456 Script path: misc/cronjobs/cart\_to\_shelf.pl
458 Does: Updates all items with a location of CART to the item's permanent
461 Required by: :ref:`NewItemsDefaultLocation`,
462 :ref:`InProcessingToShelvingCart`, &
463 :ref:`ReturnToShelvingCart` system preferences
465 Frequency suggestion: hourly
470 ~~~~~~~~~~~~~~~~~~~~~~~~~~
472 .. _delete-items-label:
475 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
477 Script path: misc/cronjobs/delete\_items.pl
479 Does: A batch item deletion tool, which generates a query against the items
480 database and deletes the items matching the criteria specified in the
481 command line arguments.
483 .. _check-url-quick-label:
486 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
488 Script path: misc/cronjobs/check-url-quick.pl
490 Does: Check URLs from biblio records.
494 This script replaces the check-url.pl script
496 .. _check-urls-label:
499 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
501 Script path: misc/cronjobs/check-url.pl
503 Does: checks URLs in 856$u field. Script output can now be formatted in
504 CSV or HTML. The HTML version links directly to MARC biblio record
507 Frequency suggestion: monthly
509 Learn more: http://wiki.koha-community.org/wiki/Check-url_enhancements
511 .. _update-authorities-label:
514 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
516 Script path: misc/migration\_tools/merge\_authority.pl
518 Does: Updates biblio data with changes to authorities records
522 The name of this script is misleading. This script does not merge
523 authorities together it instead merges authority data with linked
524 bib records. Edits to authority records will be applied to
525 bibliographic records that use that authority when this script is
528 Required by: `dontmerge <#dontmerge>`__ system preference
530 Frequency suggestion: nightly
532 .. _serials-update-label:
535 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
537 Script path: misc/cronjobs/serialsUpdate.pl
539 Does: checks if there is a "late" issue on active subscriptions, and if
540 there is, the script will set it as late, and add the next one as
543 Frequency suggestion: nightly
545 .. _automatic-item-update-label:
547 Automatic item update
548 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
550 Script path: misc/cronjobs/automatic\_item\_modification\_by\_age.pl
552 Does: updates items based on the list of rules set forth in the
553 :ref:`Automatic item modifications by age` tool
555 Required by: :ref:`Automatic item modifications by age`
557 Frequency suggestions: nightly
562 ~~~~~~~~~~~~~~~~~~~~~
567 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
569 Script path: misc/cronjobs/rss/rss.pl
571 Does: Produces an RSS XML document for any SQL query (not used for
572 search results RSS feed). :ref:`Learn more <custom-rss-feeds-label>`.
574 Frequency suggestion: hourly
576 .. _authorities-browser-label:
579 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
581 Script path: misc/cronjobs/build\_browser\_and\_cloud.pl
583 Does: Generate content for authorities browse in OPAC
585 Required by: :ref:`OpacBrowser` system preference
589 This preference and cron job should only be used on French systems.
591 .. _subject/author-clouds-label:
593 Subject/Author Clouds
594 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
596 Script path: misc/cronjobs/cloud-kw.pl
598 Does: Generates HTML keywords clouds from Koha Zebra indexes.
599 misc/cronjobs/cloud-sample.conf has a sample of how this script
602 Frequency: This is the type of script you can run once a month or so,
603 the content generated isn't going to change very much over time.
605 .. _system-administration-label:
607 System Administration
608 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
610 .. _clean-up-database-label:
613 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
615 Script path: misc/cronjobs/cleanup\_database.pl
617 Does: Truncates the sessions table, cleans out old zebraqueue entries,
618 action logs and staged MARC files.
620 .. _share-usage-stats-label:
623 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
625 Script path: misc/cronjobs/share\_usage\_with\_koha\_community.pl
627 Does: If you're sharing information via the :ref:`UsageStats`
628 feature this will send your info to the `Hea
629 website <http://hea.koha-community.org/>`__.
633 .. _acquisitions-label:
636 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
638 .. _clean-up-old-suggestions-label:
640 Clean up old suggestions
641 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
643 Script path: misc/cronjobs/purge\_suggestions.pl
645 Does: Removes old (defined by you) suggestions from the suggestion
648 .. _email-suggestions-to-process-label:
650 Email suggestions to process
651 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
653 Script path: misc/cronjobs/notice\_unprocessed\_suggestions.pl
655 Does: Generates a notice to the fund owner that there are suggestions in
658 .. _edi-message-processing-label:
660 EDI Message Processing
661 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
663 Script path: misc/cronjobs/edi\_cron.pl
665 Does: Sends and received EDI messages
667 Frequency: Every 15 minutes
669 .. _deprecated-scripts-label:
672 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
674 These should not be run without modification:
676 Script path: misc/cronjobs/update\_items.pl
678 Script path:misc/cronjobs/smsoverdues.pl
680 Script path:misc/cronjobs/notifyMailsOp.pl
682 Script path:misc/cronjobs/reservefix.pl
684 Script path:misc/cronjobs/zebraqueue\_start.pl