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 ~~~~~~~~~~~~~~~~~~~~~~~~
54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56 Script path: misc/cronjobs/sitemap.pl
58 Does: Processes all biblio records from a Koha instance and generates sitemap files
59 complying with the protocol as described on http://sitemaps.org. The goal of this
60 script is to be able to provide to search engines direct access to biblio records.
61 It avoids leaving search engines browsing Koha's OPAC which would generate a lot
62 of site traffic and server workload.
65 A file named sitemapindex.xml is generated. It contains references to multiple
66 sitemap files. Each file contains at most 50,000 URLs and it named
69 The files must be stored on the Koha OPAC's root directory. In the same directory
70 a robots.txt file with the following contents is required:
73 ``Sitemap: sitemapindex.xml
77 .. _rebuild-index-label:
80 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
82 Script path: misc/migration\_tools/rebuild\_zebra.pl
84 Does: Updates Zebra indexes with recently changed data.
88 Frequency suggestion: every x minutes, (between 5-15 minutes) depending
91 .. _circulation-label:
94 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
96 .. _holds-queue-label:
99 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
101 Script path: misc/cronjobs/holds/build\_holds\_queue.pl
103 Does: Updates holds queue report
105 Required by: :ref:`Holds Queue Report <holds-queue-label>`
107 Frequency suggestion: every 1-4 hours
111 - A script that should be run periodically if your library system
112 allows borrowers to place on-shelf holds. This script decides which
113 library should be responsible for fulfilling a given hold request.
115 It's behavior is controlled by the system preferences
116 :ref:`StaticHoldsQueueWeight <staticholdsqueueweight,-holdsqueueskipclosed-&-randomizeholdsqueueweight-label>` and
117 :ref:`RandomizeHoldsQueueWeight <staticholdsqueueweight,-holdsqueueskipclosed-&-randomizeholdsqueueweight-label>`.
119 If you do not want all of your libraries to participate in the
120 on-shelf holds fulfillment process, you should list the the libraries
121 that \*do\* participate in the process here by inputting all the
122 participating library's branchcodes, separated by commas ( e.g.
123 "MPL,CPL,SPL,BML" etc. ).
125 By default, the holds queue will be generated such that the system
126 will first attempt to hold fulfillment using items already at the
127 pickup library if possible. If there are no items available at the
128 pickup library to fill a hold, build\_holds\_queue.pl will then use
129 the list of libraries defined in StaticHoldsQueueWeight. If
130 RandomizeHoldsQueueWeight is disabled ( which it is by default ), the
131 script will assign fulfillment requests in the order the branches are
132 placed in the StaticHoldsQueueWeight system preference.
134 For example, if your system has three libraries, of varying sizes (
135 small, medium and large ) and you want the burden of holds
136 fulfillment to be on larger libraries before smaller libraries, you
137 would want StaticHoldsQueueWeight to look something like
140 If you want the burden of holds fulfillment to be spread out equally
141 throughout your library system, simply enable
142 RandomizeHoldsQueueWeight. When this system preference is enabled,
143 the order in which libraries will be requested to fulfill an on-shelf
144 hold will be randomized each time the list is regenerated.
146 Leaving StaticHoldsQueueWeight empty is contraindicated at this time.
147 Doing so will cause the build\_holds\_queue script to ignore
148 RandomizeHoldsQueueWeight, causing the script to request hold
149 fulfillment not randomly, but by alphabetical order.
151 .. _expired-holds-label:
154 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
156 Script path: misc/cronjobs/holds/cancel\_expired\_holds.pl
158 Does: By default, this cron job will only automatically cancel holds
159 where the user has set an expiration date. If the library is using the
160 :ref:`ExpireReservesMaxPickUpDelay` and
161 :ref:`ExpireReservesMaxPickUpDelayCharge`
162 preferences then this script will also cancel holds that have been
163 sitting on the hold shelf for too long and will (if the library does)
164 charge the patron for not picking up the hold.
166 Frequency suggestion: daily
168 .. _unsuspend-holds-label:
171 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
173 Script path: misc/cronjobs/holds/auto\_unsuspend\_holds.pl
175 Does: This script checks to find holds that should no longer be
176 suspended and removes the suspension if the
177 :ref:`AutoResumeSuspendedHolds` preference is
178 set to 'allow'. This puts the patron back in to the queue where they
179 were when the hold was suspended.
181 Frequency suggestion: daily
186 ^^^^^^^^^^^^^^^^^^^^^^^^^
188 Script path: misc/cronjobs/fines.pl
190 Does: Calculates and posts fines to patron accounts.
192 Required by: :ref:`finesMode` system preference
194 Frequency suggestion: nightly
196 .. _staticfines-label:
199 ^^^^^^^^^^^^^^^^^^^^^^^^^
201 Script path: misc/cronjobs/staticfines.pl
203 Does: this script calculates and charges overdue fines to patron accounts
206 If the Koha System Preference 'finesMode' is set to 'production', the fines
207 are charged to the patron accounts. If set to 'test', the fines are calculated but not applied.
210 Fines won't be applied on a holiday.
212 .. _long-overdues-label:
215 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
217 Script path: misc/cronjobs/longoverdue.pl
219 Does: allows one to specify delays for changing items to different lost
220 statuses, and optionally charge for them using the replacement price
221 listed on the item record.
223 Frequency suggestion: nightly
227 Staff can control some of the parameters for the longoverdue cron
229 :ref:`DefaultLongOverdueLostValue <defaultlongoverduelostvalue-&-defaultlongoverduedays-label>` and
230 :ref:`DefaultLongOverdueChargeValue`
233 .. _track-total-checkouts-label:
235 Track Total Checkouts
236 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
238 Script path: misc/cronjobs/update\_totalissues.pl
240 Does: updates the biblioitems.totalissues field in the database with the
241 latest tally of checkouts based on historical issue statistics.
243 Frequency suggestion: nightly
247 If the time on your database server does not match the time on your Koha
248 server you will need to take that into account, and probably use the
249 --since argument instead of the --interval argument for incremental
254 This cronjob can be used if there is a performance concern. Otherwise,
255 use the UpdateTotalIssuesOnCirc System Preference.
257 .. _generate-patron-file-for-offline-circulation-label:
259 Generate Patron File for Offline Circulation
260 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
262 Script path: misc/cronjobs/create\_koc\_db.pl
264 Does: Generates the borrowers.db file for use with the :ref:`Koha Offline
265 Circulation <offline-circ-tool-for-windows-label>` tool
267 Frequency suggestion: weekly
269 .. _automatic-renewal-label:
272 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
274 Script path: misc/cronjobs/automatic\_renewals.pl
276 Does: Will automatically renew items if you're allowing automatic
277 renewal with your :ref:`circulation and fine rules <circulation-and-fine-rules-label>`.
279 Frequency suggestion: nightly
284 ~~~~~~~~~~~~~~~~~~~~~~~~~~
286 .. _delete-patrons-label:
289 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
291 Script path: misc/cronjobs/delete\_patrons.pl
293 Does: Deletes patron records in batch based on date not borrowed since,
294 expired before, last seen, category code, or library branch.
296 .. _unverified-registrations-label:
298 Unverified Registrations
299 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
301 Script path: misc/cronjobs/delete\_expired\_opac\_registrations.pl
303 Does: Deletes patron registrations that were submitted via the OPAC but
304 not reviewed by the library within the number of days entered in the
305 :ref:`PatronSelfRegistrationExpireTemporaryAccountsDelay`
308 Frequency suggestion: nightly
310 .. _unconfirmed-registrations-label:
312 Unconfirmed Registrations
313 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
315 Script path: misc/cronjobs/delete\_unverified\_opac\_registrations.pl
317 Does: Deletes patron self registrations that were submitted via the OPAC
318 but not confirmed via email within 24 hours. This is only necessary if
319 you are requiring patrons to confirm their registrations via email with
321 :ref:`PatronSelfRegistrationVerifyByEmail`
324 Frequency suggestion: hourly
326 .. _anonymize-patron-data-label:
328 Anonymize Patron Data
329 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
331 Script path: misc/cronjobs/batch\_anonymise.pl
333 Does: Used to anonymize patron data. This will remove borrowernumbers
334 from circulation history so that the stats are kept, but the patron
335 information is removed for privacy reasons.
337 .. _update-child-to-adult-patron-type-label:
339 Update Child to Adult Patron Type
340 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
342 Script path: misc/cronjobs/j2a.pl
344 Does: Convert juvenile/child patrons from juvenile patron category and
345 category code to corresponding adult patron category and category code
346 when they reach the upper age limit defined in the Patron Categories.
348 Frequency suggestion: nightly
352 This script is designed to update patrons from juvenile to adult patron
353 types, remove the guarantor, and update their category codes
354 appropriately when they reach the upper age limit defined in the Patron
361 "juv2adult.pl" -b=<branchcode> -f=<categorycode> -t=<categorycode>
362 (Processes a single branch, and updates the patron categories from
363 category to category)
365 "juv2adult.pl" -f=<categorycode> -t=<categorycode> -v -n (Processes all
366 branches, shows all messages, and reports the patrons who would be
367 affected. Takes no action on the database)
372 ~~~~~~~~~~~~~~~~~~~~~~~~~~
374 .. _message-queue-label:
377 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
379 Script path: misc/cronjobs/process\_message\_queue.pl
381 Does: processes the message queue to send the check out, check in and
382 hold filled emails and SMS message to users and sends outgoing emails to
384 :ref:`EnhancedMessagingPreferences` to be
387 Frequency suggestion: 1-4 hours
391 Item due and Advanced due notices are controlled by the
392 :ref:`advance\_notices cron <advanced-notice-label>`.
394 .. _advanced-notice-label:
397 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
399 Script path: misc/cronjobs/advance\_notices.pl
401 Does: prepares "pre-due" notices and "item due" notices for patrons who
402 request them prepares notices for patrons for items just due or coming
404 :ref:`EnhancedMessagingPreferences` to be
407 Frequency suggestion: nightly
411 This script does not actually send the notices. It queues them in
412 the :ref:`message queue <message-queue-label>` for later
414 .. _overdue-notice-label:
417 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
419 Script path: misc/cronjobs/overdue\_notices.pl
421 Does: prepares messages to alert patrons of overdue messages (both via
424 Frequency suggestion: nightly
428 This script does not actually send the notices. It queues them in
429 the :ref:`message queue <message-queue-label>` for later or generates the
430 HTML for later printing
434 The misc/cronjobs/advance\_notices.pl program allows you to send
435 messages to patrons in advance of their items becoming due, or to alert
436 them of items that have just become due.
438 .. _printoverdues-label:
441 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
443 Script path: misc/cronjobs/printoverdues.sh
445 Does: generates PDF files from HTML files in directories and prints them
447 .. _print-hold-notices-label:
450 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
452 Script path: misc/cronjobs/gather\_print\_notices.pl
454 Does: looks through the message queue for hold notices that didn't go
455 through because the patron didn't have an email address and generates a
458 Frequency suggestion: nightly
460 .. _talking-tech-label:
463 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
465 To learn more about setting up this third party product view the
466 `Talking Tech Appendix <#talkingtechappendix>`__.
468 .. _sending-notices-file-label:
471 '''''''''''''''''''''''''''''''''''''''''''''''
473 Script path: misc/cronjobs/thirdparty/TalkingTech\_itiva\_outbound.pl
475 Does: Script to generate Spec C outbound notifications file for Talking
476 Tech i-tiva phone notification system.
479 :ref:`TalkingTechItivaPhoneNotification`
481 Frequency suggestion: nightly
483 .. _receiving-notices-file-label:
485 Receiving Notices File
486 ''''''''''''''''''''''''''''''''''''''''''''''''''''
488 Script path: misc/cronjobs/thirdparty/TalkingTech\_itiva\_inbound.pl
490 Does: Script to process received Results files for Talking Tech i-tiva
491 phone notification system.
494 :ref:`TalkingTechItivaPhoneNotification`
496 Frequency suggestion: nightly
498 .. _notify-patrons-of-expiration-label:
500 Notify Patrons of Expiration
501 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
503 Script path: misc/cronjobs/membership\_expiry.pl
505 Does: Sends messages to warn patrons of their card expiration to the
506 :ref:`messaage queue <message-queue-label>` cron.
508 Requires: :ref:`MembershipExpiryDaysNotice`
512 .. _in-processing/book-cart-label:
514 In Processing/Book Cart
515 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
517 Script path: misc/cronjobs/cart\_to\_shelf.pl
519 Does: Updates all items with a location of CART to the item's permanent
522 Required by: :ref:`NewItemsDefaultLocation`,
523 :ref:`InProcessingToShelvingCart`, &
524 :ref:`ReturnToShelvingCart` system preferences
526 Frequency suggestion: hourly
531 ~~~~~~~~~~~~~~~~~~~~~~~~~~
533 .. _import-webservice-batch-label:
535 Import Webservice Batch
536 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
538 Script path: misc/cronjobs/import\_webservice\_batch.pl
540 Does: A cron job for processing import bach queues of type 'webservice'.
541 Batches can also be processed through the UI.
545 This script is used for OCLC Connexion
547 .. _connexion-import-daemon-label:
549 Connexion Import Daemon
550 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
552 Script path: misc/bin/connexion\_import\_daemon.pl
554 Does: A daemon that listens for OCLC Connexion requests and is compliant with
555 OCLC Gateway specification. It takes requests with MARC XML and import batch
556 parameters from a configuration file and forwards it to svc/import_bib
560 This script is used for OCLC Connexion
562 .. _delete-items-label:
565 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
567 Script path: misc/cronjobs/delete\_items.pl
569 Does: A batch item deletion tool, which generates a query against the items
570 database and deletes the items matching the criteria specified in the
571 command line arguments.
573 .. _check-url-quick-label:
576 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
578 Script path: misc/cronjobs/check-url-quick.pl
580 Does: Check URLs from biblio records.
584 This script replaces the check-url.pl script
586 .. _check-urls-label:
589 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
591 Script path: misc/cronjobs/check-url.pl
593 Does: checks URLs in 856$u field. Script output can now be formatted in
594 CSV or HTML. The HTML version links directly to MARC biblio record
597 Frequency suggestion: monthly
599 Learn more: http://wiki.koha-community.org/wiki/Check-url_enhancements
601 .. _delete-records-via-leader-label:
603 Delete Records via Leader
604 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
606 Script path: misc/cronjobs/delete\_records\_via\_leader.pl
608 Does: Attempt to delete any MARC records where the leader character 5 equals 'd'
610 .. _update-authorities-label:
613 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
615 Script path: misc/cronjobs/merge\_authorities.pl
617 Does: Updates biblio data with changes to authorities records
621 The name of this script is misleading. This script does not merge
622 authorities together it instead merges authority data with linked
623 bib records. Edits to authority records will be applied to
624 bibliographic records that use that authority when this script is
627 Required by: `dontmerge <#dontmerge>`__ system preference
629 Frequency suggestion: nightly
631 .. _serials-update-label:
634 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
636 Script path: misc/cronjobs/serialsUpdate.pl
638 Does: checks if there is a "late" issue on active subscriptions, and if
639 there is, the script will set it as late, and add the next one as
642 Frequency suggestion: nightly
644 .. _automatic-item-update-label:
646 Automatic item update
647 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
649 Script path: misc/cronjobs/automatic\_item\_modification\_by\_age.pl
651 Does: updates items based on the list of rules set forth in the
652 :ref:`Automatic item modifications by age` tool
654 Required by: :ref:`Automatic item modifications by age`
656 Frequency suggestions: nightly
661 ~~~~~~~~~~~~~~~~~~~~~
666 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
668 Script path: misc/cronjobs/rss/rss.pl
670 Does: Produces an RSS XML document for any SQL query (not used for
671 search results RSS feed). :ref:`Learn more <custom-rss-feeds-label>`.
673 Frequency suggestion: hourly
675 .. _authorities-browser-label:
678 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
680 Script path: misc/cronjobs/build\_browser\_and\_cloud.pl
682 Does: Generate content for authorities browse in OPAC
684 Required by: :ref:`OpacBrowser` system preference
688 This preference and cron job should only be used on French systems.
690 .. _subject/author-clouds-label:
692 Subject/Author Clouds
693 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
695 Script path: misc/cronjobs/cloud-kw.pl
697 Does: Generates HTML keywords clouds from Koha Zebra indexes.
698 misc/cronjobs/cloud-sample.conf has a sample of how this script
701 Frequency: This is the type of script you can run once a month or so,
702 the content generated isn't going to change very much over time.
704 .. _system-administration-label:
706 System Administration
707 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
709 .. _services-throttle-label:
712 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
714 Script path: misc/cronjobs/services\_throttle.pl
716 Does: resets the xISBN services throttle
718 Frequency suggestion: nightly
720 .. _clean-up-database-label:
723 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
725 Script path: misc/cronjobs/cleanup\_database.pl
727 Does: Truncates the sessions table, cleans out old zebraqueue entries,
728 action logs and staged MARC files.
730 .. _share-usage-stats-label:
733 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
735 Script path: misc/cronjobs/share\_usage\_with\_koha\_community.pl
737 Does: If you're sharing information via the :ref:`UsageStats`
738 feature this will send your info to the `Hea
739 website <http://hea.koha-community.org/>`__.
743 .. _acquisitions-label:
746 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
748 .. _clean-up-old-suggestions-label:
750 Clean up old suggestions
751 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
753 Script path: misc/cronjobs/purge\_suggestions.pl
755 Does: Removes old (defined by you) suggestions from the suggestion
758 .. _email-suggestions-to-process-label:
760 Email suggestions to process
761 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
763 Script path: misc/cronjobs/notice\_unprocessed\_suggestions.pl
765 Does: Generates a notice to the fund owner that there are suggestions in
768 .. _edi-message-processing-label:
770 EDI Message Processing
771 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
773 Script path: misc/cronjobs/edi\_cron.pl
775 Does: Sends and received EDI messages
777 Frequency: Every 15 minutes
779 .. _remove-temporary-edi-files-label:
781 Remove Temporary EDI Files
782 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
784 Script path: misc/cronjobs/remove\_temporary\_edifiles.pl
786 Does: removes temporary EDI files that are older than 5 days
788 .. _deprecated-scripts-label:
793 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
796 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
798 Script path: misc/cronjobs/runreport.pl
800 Does: run pre-existing saved reports
803 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
805 These should not be run without modification:
807 Script path: misc/cronjobs/update\_items.pl
809 Script path:misc/cronjobs/smsoverdues.pl
811 Script path:misc/cronjobs/notifyMailsOp.pl
813 Script path:misc/cronjobs/reservefix.pl
815 Script path:misc/cronjobs/zebraqueue\_start.pl