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 .. _delete-patrons-label:
247 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
249 Script path: misc/cronjobs/delete\_patrons.pl
251 Does: Deletes patron records in batch based on date not borrowed since,
252 expired before, last seen, category code, or library branch.
254 .. _unverified-registrations-label:
256 Unverified Registrations
257 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
259 Script path: misc/cronjobs/delete\_expired\_opac\_registrations.pl
261 Does: Deletes patron registrations that were submitted via the OPAC but
262 not reviewed by the library within the number of days entered in the
263 :ref:`PatronSelfRegistrationExpireTemporaryAccountsDelay`
266 Frequency suggestion: nightly
268 .. _unconfirmed-registrations-label:
270 Unconfirmed Registrations
271 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
273 Script path: misc/cronjobs/delete\_unverified\_opac\_registrations.pl
275 Does: Deletes patron self registrations that were submitted via the OPAC
276 but not confirmed via email within 24 hours. This is only necessary if
277 you are requiring patrons to confirm their registrations via email with
279 :ref:`PatronSelfRegistrationVerifyByEmail`
282 Frequency suggestion: hourly
284 .. _anonymize-patron-data-label:
286 Anonymize Patron Data
287 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
289 Script path: misc/cronjobs/batch\_anonymise.pl
291 Does: Used to anonymize patron data. This will remove borrowernumbers
292 from circulation history so that the stats are kept, but the patron
293 information is removed for privacy reasons.
295 .. _update-child-to-adult-patron-type-label:
297 Update Child to Adult Patron Type
298 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
300 Script path: misc/cronjobs/j2a.pl
302 Does: Convert juvenile/child patrons from juvenile patron category and
303 category code to corresponding adult patron category and category code
304 when they reach the upper age limit defined in the Patron Categories.
306 Frequency suggestion: nightly
310 This script is designed to update patrons from juvenile to adult patron
311 types, remove the guarantor, and update their category codes
312 appropriately when they reach the upper age limit defined in the Patron
319 "juv2adult.pl" -b=<branchcode> -f=<categorycode> -t=<categorycode>
320 (Processes a single branch, and updates the patron categories from
321 category to category)
323 "juv2adult.pl" -f=<categorycode> -t=<categorycode> -v -n (Processes all
324 branches, shows all messages, and reports the patrons who would be
325 affected. Takes no action on the database)
330 ~~~~~~~~~~~~~~~~~~~~~~~~~~
332 .. _message-queue-label:
335 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
337 Script path: misc/cronjobs/process\_message\_queue.pl
339 Does: processes the message queue to send the check out, check in and
340 hold filled emails and SMS message to users and sends outgoing emails to
342 :ref:`EnhancedMessagingPreferences` to be
345 Frequency suggestion: 1-4 hours
349 Item due and Advanced due notices are controlled by the
350 :ref:`advance\_notices cron <advanced-notice-label>`.
352 .. _advanced-notice-label:
355 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
357 Script path: misc/cronjobs/advance\_notices.pl
359 Does: prepares "pre-due" notices and "item due" notices for patrons who
360 request them prepares notices for patrons for items just due or coming
362 :ref:`EnhancedMessagingPreferences` to be
365 Frequency suggestion: nightly
369 This script does not actually send the notices. It queues them in
370 the :ref:`message queue <message-queue-label>` for later
372 .. _overdue-notice-label:
375 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
377 Script path: misc/cronjobs/overdue\_notices.pl
379 Does: prepares messages to alert patrons of overdue messages (both via
382 Frequency suggestion: nightly
386 This script does not actually send the notices. It queues them in
387 the :ref:`message queue <message-queue-label>` for later or generates the
388 HTML for later printing
392 The misc/cronjobs/advance\_notices.pl program allows you to send
393 messages to patrons in advance of their items becoming due, or to alert
394 them of items that have just become due.
396 .. _print-hold-notices-label:
399 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
401 Script path: misc/cronjobs/gather\_print\_notices.pl
403 Does: looks through the message queue for hold notices that didn't go
404 through because the patron didn't have an email address and generates a
407 Frequency suggestion: nightly
409 .. _talking-tech-label:
412 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
414 To learn more about setting up this third party product view the
415 `Talking Tech Appendix <#talkingtechappendix>`__.
417 .. _sending-notices-file-label:
420 '''''''''''''''''''''''''''''''''''''''''''''''
422 Script path: misc/cronjobs/thirdparty/TalkingTech\_itiva\_outbound.pl
424 Does: Script to generate Spec C outbound notifications file for Talking
425 Tech i-tiva phone notification system.
428 :ref:`TalkingTechItivaPhoneNotification`
430 Frequency suggestion: nightly
432 .. _receiving-notices-file-label:
434 Receiving Notices File
435 ''''''''''''''''''''''''''''''''''''''''''''''''''''
437 Script path: misc/cronjobs/thirdparty/TalkingTech\_itiva\_inbound.pl
439 Does: Script to process received Results files for Talking Tech i-tiva
440 phone notification system.
443 :ref:`TalkingTechItivaPhoneNotification`
445 Frequency suggestion: nightly
447 .. _notify-patrons-of-expiration-label:
449 Notify Patrons of Expiration
450 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
452 Script path: misc/cronjobs/membership\_expiry.pl
454 Does: Sends messages to warn patrons of their card expiration to the
455 :ref:`messaage queue <message-queue-label>` cron.
457 Requires: :ref:`MembershipExpiryDaysNotice`
461 .. _in-processing/book-cart-label:
463 In Processing/Book Cart
464 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
466 Script path: misc/cronjobs/cart\_to\_shelf.pl
468 Does: Updates all items with a location of CART to the item's permanent
471 Required by: :ref:`NewItemsDefaultLocation`,
472 :ref:`InProcessingToShelvingCart`, &
473 :ref:`ReturnToShelvingCart` system preferences
475 Frequency suggestion: hourly
480 ~~~~~~~~~~~~~~~~~~~~~~~~~~
482 .. _delete-items-label:
485 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
487 Script path: misc/cronjobs/delete\_items.pl
489 Does: A batch item deletion tool, which generates a query against the items
490 database and deletes the items matching the criteria specified in the
491 command line arguments.
493 .. _check-url-quick-label:
496 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
498 Script path: misc/cronjobs/check-url-quick.pl
500 Does: Check URLs from biblio records.
504 This script replaces the check-url.pl script
506 .. _check-urls-label:
509 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
511 Script path: misc/cronjobs/check-url.pl
513 Does: checks URLs in 856$u field. Script output can now be formatted in
514 CSV or HTML. The HTML version links directly to MARC biblio record
517 Frequency suggestion: monthly
519 Learn more: http://wiki.koha-community.org/wiki/Check-url_enhancements
521 .. _delete-records-via-leader-label:
523 Delete Records via Leader
524 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
526 Script path: misc/cronjobs/delete\_records\_via\_leader.pl
528 Does: Attempt to delete any MARC records where the leader character 5 equals 'd'
530 .. _update-authorities-label:
533 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
535 Script path: misc/migration\_tools/merge\_authority.pl
537 Does: Updates biblio data with changes to authorities records
541 The name of this script is misleading. This script does not merge
542 authorities together it instead merges authority data with linked
543 bib records. Edits to authority records will be applied to
544 bibliographic records that use that authority when this script is
547 Required by: `dontmerge <#dontmerge>`__ system preference
549 Frequency suggestion: nightly
551 .. _serials-update-label:
554 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
556 Script path: misc/cronjobs/serialsUpdate.pl
558 Does: checks if there is a "late" issue on active subscriptions, and if
559 there is, the script will set it as late, and add the next one as
562 Frequency suggestion: nightly
564 .. _automatic-item-update-label:
566 Automatic item update
567 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
569 Script path: misc/cronjobs/automatic\_item\_modification\_by\_age.pl
571 Does: updates items based on the list of rules set forth in the
572 :ref:`Automatic item modifications by age` tool
574 Required by: :ref:`Automatic item modifications by age`
576 Frequency suggestions: nightly
581 ~~~~~~~~~~~~~~~~~~~~~
586 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
588 Script path: misc/cronjobs/rss/rss.pl
590 Does: Produces an RSS XML document for any SQL query (not used for
591 search results RSS feed). :ref:`Learn more <custom-rss-feeds-label>`.
593 Frequency suggestion: hourly
595 .. _authorities-browser-label:
598 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
600 Script path: misc/cronjobs/build\_browser\_and\_cloud.pl
602 Does: Generate content for authorities browse in OPAC
604 Required by: :ref:`OpacBrowser` system preference
608 This preference and cron job should only be used on French systems.
610 .. _subject/author-clouds-label:
612 Subject/Author Clouds
613 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
615 Script path: misc/cronjobs/cloud-kw.pl
617 Does: Generates HTML keywords clouds from Koha Zebra indexes.
618 misc/cronjobs/cloud-sample.conf has a sample of how this script
621 Frequency: This is the type of script you can run once a month or so,
622 the content generated isn't going to change very much over time.
624 .. _system-administration-label:
626 System Administration
627 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
629 .. _clean-up-database-label:
632 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
634 Script path: misc/cronjobs/cleanup\_database.pl
636 Does: Truncates the sessions table, cleans out old zebraqueue entries,
637 action logs and staged MARC files.
639 .. _share-usage-stats-label:
642 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
644 Script path: misc/cronjobs/share\_usage\_with\_koha\_community.pl
646 Does: If you're sharing information via the :ref:`UsageStats`
647 feature this will send your info to the `Hea
648 website <http://hea.koha-community.org/>`__.
652 .. _acquisitions-label:
655 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
657 .. _clean-up-old-suggestions-label:
659 Clean up old suggestions
660 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
662 Script path: misc/cronjobs/purge\_suggestions.pl
664 Does: Removes old (defined by you) suggestions from the suggestion
667 .. _email-suggestions-to-process-label:
669 Email suggestions to process
670 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
672 Script path: misc/cronjobs/notice\_unprocessed\_suggestions.pl
674 Does: Generates a notice to the fund owner that there are suggestions in
677 .. _edi-message-processing-label:
679 EDI Message Processing
680 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
682 Script path: misc/cronjobs/edi\_cron.pl
684 Does: Sends and received EDI messages
686 Frequency: Every 15 minutes
688 .. _deprecated-scripts-label:
691 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
693 These should not be run without modification:
695 Script path: misc/cronjobs/update\_items.pl
697 Script path:misc/cronjobs/smsoverdues.pl
699 Script path:misc/cronjobs/notifyMailsOp.pl
701 Script path:misc/cronjobs/reservefix.pl
703 Script path:misc/cronjobs/zebraqueue\_start.pl