Elaborazioni pianificate

Koha is supported by a number of background tasks. These tasks can either be periodically executed tasks (cron jobs) or continuously running tasks called daemons.

Un’elaborazione pianificata è un comando Linux per programmare l’esecuzione di un comando o di uno script sul server, che serve ad eseguire automaticamente processi ripetitivi. Gli script eseguiti come elaborazioni pianificate si usano solitamente per modificare file o database; tuttavia, possono eseguire compiti di altro genere, che non modifichino dati sul server, come ad esempio inviare notifiche per e-mail.

Un demone è un comando Linux che è normalmente fatto partire insieme all’accensione del server, e attende comandi e li esegue immediatamente. Il database usato da Koha (MySQL o MariaDB) è un demone, così come il web server (tipicamente Apache).

Koha has many cron jobs in place that you can enable (search engine indexing, overdue notice generation, data cleanup and more), and a few daemons. This chapter will explain those for you.

Esempio di crontab

Un esempio di crontab di Koha si trova in misc/cronjobs/crontab.example

L’esempio include tipiche righe di cron job usati più spesso.

Elaborazioni pianificate

The locations in the documentation assume a development install where files are found in misc/ relative to the git root checkout. If you have installed using Debian packages or the standard install from source, you will want to look for files in /usr/share/koha/bin/.

Other locations are possible with other installation methods. You can perform a simple find search if they are not located in these directories.

Nota

For anyone with shell access using Debian packages, the following command is an easy way to find files installed by a Debian package:

dpkg -L koha-common

This provides a comprehensive listing of the files installed by the koha-common package. You can then easily find the file from there.

Copia di sicurezza

Copia di sicurezza giornaliera

Script path: misc/cronjobs/backup.sh

Crea una copia di sicurezza del database di Koha.

Frequenza consigliata: giornaliera

Circolazione

Prenotazioni in coda

Script path: misc/cronjobs/holds/build_holds_queue.pl

Che cosa fa: aggiorna il tabulato della coda delle prenotazioni.

Richiesto da: Holds Queue Report

Frequenza consigliata: ogni 1-4 ore

Descrizione:

  • Si tratta di uno script che dovrebbe essere eseguito periodicamente, se la vostra biblioteca permette agli utenti di richiedere prenotazioni a scaffale. Questo script decide quale biblioteca deve incaricarsi di soddifare una data richiesta di prenotazione.

    Il comportamento è controllato dalle preferenze di sistema StaticHoldsQueueWeight e RandomizeHoldsQueueWeight.

    Se non vuoi che le tue biblioteche partecipino al processo di assegnazione di prenotazioni, *devi* comunque elencare qui le biblioteche che vi prendono parte, con una lista di codici di biblioteca separate da virgola (es.: «MPL,CPL,SPL,BML» ecc. ).

    Per default, la coda delle prenotazioni funziona in modo che il sistema prima tenta di soddisfare una prenotazione utilizzando copie che sono già presso la biblioteca del ritiro. In mancanza, build_holds_queue.pl userà la lista di biblioteche definite in StaticHoldsQueueWeight. Se RandomizeHoldsQueueWeight non è attiva (come da default), lo script assegnerà le richieste in base alla preferenza di sistema StaticHoldsQueueWeight.

    Per esempio, se il tuo sistema ha tre biblioteche, di varia dimensione (piccola, media e grande) e vuoi che il processo di assegnazione prenotazioni usi prima la alla grande biblioteca e poi le piccole, potresti impostare la preferenza di sistema “StaticHoldsQueueWeight” a «LRG,MED,SML».

    Se vuoi che il carico delle prenotazioni venga suddiviso equamente tra le varie biblioteche del sistema, abilita la preferenza di sistema RandomizeHoldsQueueWeight. Quando è attiva, l’ordine delle biblioteche verrà rigenerato casualmente ogni volta che viene creata la loro lista.

Prenotazioni scadute

Script path: misc/cronjobs/holds/cancel_expired_holds.pl

Does: cancels holds where the user has set an expiration date. If the library is using the ExpireReservesMaxPickUpDelay and ExpireReservesMaxPickUpDelayCharge preferences then this script will also cancel holds that have been sitting on the hold shelf for too long and will (if the library does) charge the patron for not picking up the hold.

It is possible to add a cancellation reason with the –reason parameter. Use the cancellation code from the HOLD_CANCELLATION authorized value category

Frequenza consigliata: giornaliera

Annulla sospensione prenotazioni

Script path: misc/cronjobs/holds/auto_unsuspend_holds.pl

Does: checks to find holds that should no longer be suspended and removes the suspension if the AutoResumeSuspendedHolds preference is set to “allow”. This puts the patron back in to the queue where they were when the hold was suspended.

Frequenza consigliata: giornaliera

Multe

Script: misc/cronjobs/fines.pl

Fa: calcola e addebita (o incrementa il debito) tariffe di scadenza prestito agli utenti. Il calcolo della tariffa tiene conto del periodo di grazie, intervallo di multa, ammontare del debito e altri parametri delle regole per la circolazione e multe.

Required by: finesMode system preference

Frequenza consigliata: notturna

Nota Se la preferenza di sistema “finesMode” è impostata a “production”, le multe vengono attribuite agli account degli utenti. Se è impostata a “test”, le multe vengono calcolate ma non attribuite.

Nota Le multe non verranno attribuite durante le feste.

PARAMETERS - -h|–help

  • prendi un messaggio di aiuto

  • -l|–log

    • log the output to a file (optional if the -o parameter is given)

  • -o|–out

    • output directory for logs (defaults to env or /tmp if the directory does not exist)

  • -v|–verbose

    • verbose mode

  • -m|–maxdays

    • how many days back of overdues to process

    • this can improve performance by simply the number of records that need to be processed. It can be safe to limit the overdues processed to those under X days overdues given that circulation policy often caps fines at a maximum after a number of days.

Multe statiche

Script path: misc/cronjobs/staticfines.pl

Does: charges a single static fine for any/all overdues a patron currently has outstanding. The charge amount is either defined on the command line per borrower category or will use the circulation rules associated with the oldest overdue item the patron has currently checked out (for the first fine period only) Once charged, the fine is static: No new fines will be added until the existing fine is paid off in full.

Frequenza consigliata: notturna

Nota Se la preferenza di sistema “finesMode” è impostata a “production”, le multe vengono attribuite agli account degli utenti. Se è impostata a “test”, le multe vengono calcolate ma non attribuite.

Nota Le multe non verranno attribuite durante le feste.

Batch writeoff charges

Script path: misc/cronjobs/writeoff_debts.pl

Does: writes off outstanding charges in patron accounts.

PARAMETERS

Nota

The options to select the debt records to writeoff are cumulative. For example, supplying both --added_before and --type specifies that the accountline must meet both conditions to be selected for writeoff.

Nota

You must use at least one of the filtering options for the script to run. This is to prevent an accidental “writeoff all” operation.

  • -h | --help

    • Displays help message.

  • -v | --verbose

    • Verbose output.

  • --added-before

    • Write off charges added before the specified date.

    • Dates should be in ISO format, e.g., 2013-07-19, and can be generated with date -d '-3 month' --iso-8601.

  • --added-after

    • Write off charges added after the specified date.

    • Dates should be in ISO format, e.g., 2013-07-19, and can be generated with date -d '-3 month' --iso-8601.

    Version

    The --added-after parameter was added in Koha version 23.11.

  • --category-code

    • Write off charges of patrons belonging to the specified categories.

    • Repeatable.

    Version

    The --category-code parameter was added in Koha version 23.11.

  • --type

  • --file

    • Write off charges passed as one accountlines_id per line in this file.

    • If other criteria are defined it will only writeoff those in the file that match those criteria.

  • --confirm

    • This parameter is needed to actually writeoff the charges.

    • Running the script without this parameter will only output which charges would have been written off.

ESEMPI DI USO

writeoff_debts.pl --added_after 2023-06-20 --confirm

Will write off charges added after 2023-06-20.

writeoff_debts.pl --added_before `date -d '-3 month' --iso-8601` --category-code K --confirm

Will write off charges older than 3 months for patrons in the “K” category.

Lungo ritardo

Percorso dello script: misc/cronjobs/longoverdue.pl

Che cosa fa: permette di specificare i ritardi necessari per cambiare lo stato di “smarrito” di un elemento ad un valore differente. Opzionalmente addebita gli elementi smarriti, utilizzando il prezzo di sostituzione registrato nel record di ciascun elemento.

Frequenza consigliata: notturna

Nota

Staff can control some of the parameters for the longoverdue cron job with the DefaultLongOverdueLostValue and DefaultLongOverdueChargeValue preferences.

Traccia il totale dei prestiti

Script path: misc/cronjobs/update_totalissues.pl

Che cosa fa: aggiorna il campo biblioitems.totalissues nel database con il il totale aggiornato dei prestiti basandosi sulle statistiche dello storico prestiti.

Frequenza consigliata: notturna

Avvertimento

Se l’ora sul server del database non coincide con l’ora sul server di Koha, bisogna tenerne conto e probabilmente utilizzare l’opzione –since, invece dell’opzione –interval, per l’aggiornamento incrementale.

Nota

This cronjob can be used if there is a performance concern. Otherwise, use the UpdateTotalIssuesOnCirc System preference.

Genera file utenti per la circolazione offline

Script path: misc/cronjobs/create_koc_db.pl

Che cosa fa: genera il file borrowers.db da utilizzare con lo strumento Circolazione offline

Frequenza consigliata: settimanale

Rinnovo automatico

Script path: misc/cronjobs/automatic_renewals.pl

Che cosa fa: esegue il rinnovo automatico dei prestiti, se in Circolazione e regole dei ritardi è stato abilitato il rinnovo automatico.

Frequenza consigliata: notturna

Importante

To run this properly, you must use the –confirm parameter, otherwise it will only run in test mode

PARAMETERS - -h|–help

  • prendi un messaggio di aiuto

  • –send-notices

    • sends the AUTO_RENEWALS notice to patrons if the automatic renewal has been done

  • -v|–verbose

    • verbose mode

  • -c|–confirm

    • without this parameter no changes will be made, the script will run in test mode

    • without this parameter, the script will default to verbose mode as well

Automatic checkin

Script path: misc/cronjobs/automatic_checkin.pl

Does: automatically checks in items after the loan period. This is set at the item type level.

Frequenza consigliata: notturna

Recalls

Expire recalls

Script path: misc/cronjobs/recalls/expire_recalls.pl

Does: automatically marks as expired recalls that

  • have been requested, but have not been fulfilled and are past their expiry date

  • recalls that have been awaiting pickup longer than the pickup period in the circulation rules or the period set in the RecallsMaxPickUpDelay system preference

Frequenza consigliata: notturna

Overdue recalls

Script path: misc/cronjobs/recalls/overdue_recalls.pl

Does: sets a recalled item as overdue if it hasn’t been returned by the adjusted due date

Frequenza consigliata: notturna

Utenti

Cancellazione utenti in batch

Script path: misc/cronjobs/delete_patrons.pl

Esegue: cancella record utenti in batch in base a data di ultimo prestito, scaduto prima di, visto per l’ultima volta il, codice categoria, o biblioteca.

Nota

Dates should be in ISO format, e.g., 2013-07-19, and can be generated with date -d “-3 month” «+%Y-%m-%d».

Importante

The options to select the patron records to delete are cumulative. For example, supplying both –expired_before and –library specifies that patron records must meet both conditions to be selected for deletion.

PARAMETERS

  • –not_borrowed_since Delete patrons who have not borrowed since this date.

    Avvertimento

    Patrons who have all their old checkouts anonymized will have an empty circulation history and be deleted if this option is used. Anonymization can happen because the patron has borrowers.privacy = 2, through cronjobs doing anonymization or by the patron choosing to anonymize their history in the OPAC.

  • –expired_before Delete patrons with an account expired before this date.

  • –last_seen Delete patrons who have not been connected since this date. The system preference TrackLastPatronActivity must be enabled to use this option.

  • –category_code Delete patrons who have this category code.

  • –library Delete patrons in this library.

  • -c|–confirm This flag must be provided in order for the script to actually delete patron records. If it is not supplied, the script will only report on the patron records it would have deleted.

  • -v|–verbose Verbose mode.

Rendi anonimi i dati degli utenti

Script path: misc/cronjobs/batch_anonymise.pl

Che cosa fa: si usa per rendere anonimi i dati degli utenti. Rimuove il dato borrowernumbers dallo storico della circolazione; in questo modo le statistiche vengono mantenute, ma le informazioni sugli utenti vengono elimiante per ragioni di riservatezza.

Update patron categories

Script path: misc/cronjobs/update_patrons_category.pl

Che cosa fa: trasforma un utente assegnato alla categoria ragazzi/giovani, inserendolo nella corrispondente categoria adulti, quando l’utente raggiunge il limite di età superiore impostato nelle Categorie utenti.

This script replaces the j2a.pl script.

Frequenza consigliata: notturna

DESCRIZIONE

This script is designed to update patrons from one category to another using the criteria specified using command line arguments.

PARAMETERS

  • –too_old Update, if patron is over the upper age limit of their current patron category.

  • –too_young Update, if patron is below the minimum age limit of their patron category.

  • –fo=X|–fineover=X Update, if the total fine amount on the patron account is over X.

  • –fu=X|–fineunder=X Update, if the total fine amount on the patron account is below X.

  • –rb=date|regbefore=date Update, if the registration date of the patron is before the given date.

  • –ra=date|regafter=date Update, if the registration date of the patron is after the given date.

  • -d –field name=value Update, if the given condition is met. <name> has to be replaced by a column name of the borrowers table. The condition is met, if the the content of the field equals <value>.

  • –where <conditions> Update, if the SQL <where> clause is met.

  • -v|–verbose Verbose mode: Without this flag only fatal errors are reported.

  • -c|–confirm Commits the changes to the database. No changes will be made unless this argument is added to the command.

  • -b|–branch <branchcode> Update, if the home branch of the patron matches the <branchcode> given.

  • -f|–form <categorycode> Update, if the patron currently has this patron category.

  • -t|–to <categorycode> Update the patrons matching the criteria to this patron category.

ESEMPI DI USO

«update_patrons_category.pl»

«update_patrons_category.pl» -b=<branchcode> -f=<categorycode> -t=<categorycode> -c» (Elabora una singola biblioteca e cambia le categorie utenti da categoria a categoria)

«update_patrons_category.pl» -f=<categorycode> -t=<categorycode> -v» (Elabora tutte le biblioteche, mostra tutti i messaggi ed elenca gli utenti che sarebbero influenzati dalla modifica. Non apporta nessun cambiamento sul database)

Update patrons” messaging preferences

Script path: misc/maintenance/borrowers-force-messaging-defaults.pl

Does: updates patrons” messaging preferences to the default values set in the patron categories.

Messaging preferences defaults are automatically set when adding a new patron or when importing patrons with the patron import tool. However, if you import patrons directly in the database, these messaging preferences will not be set.

There is no suggested frequency. This is a tool to be used when needed, although if you regularly import patrons directly in the database (through a third-party, for example), you can add it to your crontab.

DESCRIZIONE

If the EnhancedMessagingPreferences system preference is enabled after borrowers have been created in the DB, those borrowers won’t have messaging transport preferences default values as defined for their borrower category. So you would have to modify each borrower one by one if you would like to send them “Hold Filled” notice for example.

This script creates/overwrites messaging preferences for all borrowers and sets them to default values defined for the category they belong to (unless you use the options -not-expired or -no-overwrite to update a subset).

PARAMETERS

  • --help

    • Display help message.

  • --doit

    • Update the patrons. The script will not update patrons” messaging preferences without this option. It will only list the patrons who would have been updated.

  • --not-expired

    • Only update patrons who are still active (whose files are not yet expired).

  • --no-overwrite

    • Only update patrons without any messaging preferences. This option will skip patrons who have already set their preferences.

  • --category

    • Only update patrons from the specified category.

    Avvertimento

    This option cannot be repeated.

    For example:

    borrowers-force-messaging-defaults.pl --doit --category PT --category B
    

    will only update patrons from category B (the last category specified).

  • --library

    • Will only update patrons whose home library matches the given branchcode.

    Version

    The --library parameter was added in Koha version 23.11.

  • --message-name

    • Will only update preferences for the specific message.

    • The list of values can be found in installer/data/mysql/mandatory/sample_notices_message_attributes.sql, in message_attributes.message_name in the database, or in the notices and slips tool.

    Version

    The --message-name parameter was added in Koha version 23.11.

  • --since

    • Only update patrons enrolled since the specified date.

    Nota

    This option can use specific or relative dates.

    For example:

    borrowers-force-messaging-defaults.pl --doit --since "2022-07-12"
    

    will only update patrons enrolled since July 12, 2022.

    And:

    borrowers-force-messaging-defaults.pl --doit --since `date -d "1 day ago" '+%Y-%m-%d'
    

    will only update patrons enrolled since yesterday.

ESEMPI DI USO

borrowers-force-messaging-defaults.pl --doit

Updates all patrons to give them the default messaging preferences values from their respective category.

borrowers-force-messaging-defaults.pl --doit --not-expired

Updates all patrons whose memberships are not expired to give them the default messaging preferences values from their respective category.

borrowers-force-messaging-defaults.pl --doit --category PT

Updates all patrons in the PT category to give them the default messaging preferences for that category.

borrowers-force-messaging-defaults.pl --doit --no-overwrite --since "2022-03-01"

Updates patrons who do not have any messaging preferences set and who are enrolled since March 1st, 2022.

borrowers-force-messaging-defaults.pl --doit --no-overwrite --since `date -d "1 day ago" '+%Y-%m-%d'

Updates patrons who do not have any messaging preferences set and who are enrolled since yesterday.

borrowers-force-messaging-defaults.pl --doit --library CPL

Updates patrons whose home library is CPL.

borrowers-force-messaging-defaults.pl --doit --message-name Item_due

Updates preferences for the «Item due» message only.

Avvisi

Coda dei messaggi

Script path: misc/cronjobs/process_message_queue.pl

Does: processes the message queue to send outgoing emails and SMS messages to patrons. Messages are queued in the message queue by other scripts, such as advance_notices.pl, overdue_notices.pl, and holds_reminder.pl.

Nota

Requires that EnhancedMessagingPreferences be set to “Allow”.

Frequenza consigliata: 1-4 ore

DESCRIZIONE

This script processes the message queue in the message_queue database table. It sends out the messages in that queue and marks them appropriately to indicate success or failure. It is recommended that you run this regularly from cron, especially if you are using the advance_notices.pl script.

PARAMETERS

  • -u | –username

    • Username of the mail account used to send the notices.

  • -p | –password

    • Password of mail account used to send the notices.

  • -t | –type

    • If supplied, only processes this type of message. Possible values are

      • email

      • sms

    • Repeatable

  • -c | –code

    • If supplied, only processes messages with this letter code.

    • Repeatable.

  • -l | –limit

    • The maximum number of messages to process for this run.

  • -m | –method

    • Authentication method required by SMTP server (see perldoc Sendmail.pm for supported authentication types).

  • -h | –help

    • Help message.

  • -v | –verbose

    • Provides verbose output to STDOUT.

  • -w | –where

    • Filter messages to send with additional conditions in a where clause.

Avvisi estesi

Script path: misc/cronjobs/advance_notices.pl

Does: prepares «pre-due» notices and «item due» notices for patrons who request them prepares notices for patrons for items just due or coming due soon. requires EnhancedMessagingPreferences to be on

Frequenza consigliata: notturna

Nota

Questo script non invia effettivamente gli avvisi; li inserisce nella coda dei messaggi, da cui saranno spediti in seguito.

Avviso di scadenza

Script path: misc/cronjobs/overdue_notices.pl

Che cosa fa:prepara gli avvisi per avvertire gli utenti (sia via mail, sia su carta) che il termine del prestito è scaduto.

Frequenza consigliata: notturna

DESCRIZIONE

This script creates and queues the overdue notices according to the parameters set in the overdue notice/status triggers tool.

PARAMETERS

  • -n | –nomail

    • Do not send any email. Overdue notices that would have been sent to the patrons or to the admin are printed to standard out. CSV data (if the –csv flag is set) is written to standard out or to any CSV filename given.

  • –max <days>

    • Maximum days overdue to deal with.

    • Items overdue since longer than max days are assumed to be handled somewhere else, probably the longoverdues script. They are therefore ignored by this script. No notices are sent for them, and they are not added to any CSV files.

    • Defaults to 90 days.

  • –library <branchcode>

    • Only deal with overdues from this library.

    • Use the value in the branches.branchcode table.

    • This parameter is repeatable, to process overdues for a group of libraries.

  • –csv <filename>

    • Produces a CSV file.

    • If the -n (no mail) flag is set, this CSV data is sent to standard out or to a filename if provided. Otherwise, only overdues that could not be emailed are sent in CSV format to the admin.

  • –html <directory>

    • Output html to a file in the given directory.

    • If a patron does not have an email address or if the -n (no mail) flag is set, an HTML file is generated in the specified directory. This can be downloaded or further processed by library staff.

    • The file will be called notices-YYYY-MM-DD.html and placed in the directory specified.

  • –text <directory>

    • Output plain text to a file in the given directory.

    • If a patron does not have an email address or if the -n (no mail) flag is set, a text file is generated in the specified directory. This can be downloaded or further processed by library staff.

    • The file will be called notices-YYYY-MM-DD.txt and placed in the directory specified.

  • –itemscontent <list of fields>

    • Item information in templates.

    • Takes a comma separated list of fields that get substituted into templates in places of the <<items.content>> placeholder.

    • Defaults to due date,title,barcode,author

    • Other possible values come from fields in the biblio, items and issues tables.

  • –borcat <categorycode>

    • Prepare only overdue notices for specified patron categories.

    • This parameter is repeatable, to include several patron categories.

    • Use the value in categories.categorycode.

  • –borcatout <categorycode>

    • Do not prepare overdue notices for specified patron categories.

    • This parameter is repeatable, to exclude several patron categories.

    • Use the value in categories.categorycode.

    • t | –triggered

    • This option causes a notice to be generated if and only if an item is overdue by the number of days defined in the overdue notice trigger.

    • By default, a notice is sent each time the script runs, which is suitable for less frequent run cron script, but requires syncing notice triggers with the cron schedule to ensure proper behavior.

    • Add the –triggered option for daily cron, at the risk of no notice being generated if the cron fails to run on time.

  • –test

    • This option makes the script run in test mode.

    • In test mode, the script won’t make any changes on the DB. This is useful for debugging configuration.

  • –list-all

    • By default, <<items.content>> lists only those items that fall in the range of the currently processing notice.

    • Choose –list-all to include all overdue items in the list (limited by the –max setting).

  • –date <yyyy-mm-dd>

    • Emulate overdues run for this date.

  • –email <email_type>

    • Specify the type of email that will be used.

    • Can be “email”, “emailpro” or “B_email”.

    • This parameter is repeatable.

  • –frombranch

    • Organize and send overdue notices by home library (item-homebranch) or checkout library (item-issuebranch).

    • Defaults to item-issuebranch.

    Nota

    This option is only used if the OverdueNoticeFrom system preference is set to “command-line option”.

ESEMPI DI USO

«overdue_notices.pl»

(All libraries are processed individually, and notices are prepared for all patrons with overdue items for whom we have email addresses. Messages for those patrons for whom we have no email address are sent in a single attachment to the library administrator’s email address, or to the address in the KohaAdminEmailAddress system preference.)

«overdue_notices.pl -n –csv /tmp/overdues.csv»

(Sends no email and populates /tmp/overdues.csv with information about all overdue items.)

«overdue_notices.pl –library MAIN max 14

(Prepares notices of overdues in the last 2 weeks for the MAIN library.)

Nota

This script does not actually send the notices. It queues them in the message queue to be sent later or generates the HTML for printing.

Nota

See also:

The misc/cronjobs/advance_notices.pl script allows you to send messages to patrons in advance of their items becoming due, or to alert them of items that have just become due.

The misc/cronjobs/process_message_queue.pl script sends the emails.

Holds reminder

Script path: misc/cronjobs/holds/holds_reminder.pl

Does: prepares reminder messages to be sent to patrons with waiting holds.

EnhancedMessagingPreferences must be set to “Allow”, and patrons must have requested to have this notice (either through the Messaging tab in their online account in the OPAC, if EnhancedMessagingPreferencesOPAC is set to “Show”, or in their messaging preferences in the staff interface).

Frequenza consigliata: notturna

PARAMETERS

  • -c | –confirm

    • Confirm flag, no email will be generated if this parameter is not set

  • -date <YYYY-MM-DD>

    • Send notices as would have been sent on a specific date

  • -days <number of days>

    • Number of days the hold has been waiting

    • If this parameter is not set, a notice will be sent to all patrons with waiting holds

    • Optional parameter

  • -holidays

    • Use the calendar exclude holidays from waiting days

  • -lettercode <lettercode>

    • Code of the predefined notice to use

    • Optional parameter, the default is HOLD_REMINDER

  • -library <branchcode>

    • Only deal with holds from this library

    • This flag is repeatable, to select notices for a group of libraries

  • -mtt <message_transport_type>

    • Type of messages to send (email, sms, print)

      • “email” and “sms” will fall back to “print” if the patron does not have an email address/phone number

    • The default is to use the patrons” messaging preferences for the “Hold reminder” notice

    • Passing this parameter will force send even if the patron has not chosen to receive hold reminder notices

    • This can be repeated to send various notices

  • -t | –triggered

    • Include only holds <days> days waiting, and not longer

    • If this is not set, the script will send messages for all holds waiting for equal to or more than <days> days

    • This option is useful if the cron is being run daily to avoid spamming the patrons

    • Optional parameter

  • -v

    • Verbose

    • Without this flag set, only fatal errors are reported.

    • If verbose is set but not confirm, a list of notices that would have been sent to the patrons are printed to standard out

  • -help

    • Brief help message

  • -man

    • Full documentation

    EXAMPLES

    Ecco alcuni esempi di script:

    ::

    holds_reminder.pl -library MAIN -days 14

    prepares notices of holds waiting for 2 weeks for the MAIN library

    ::

    holds_reminder.pl -lettercode LATE_HOLDS -library MAIN -days 14

prepares notices of holds waiting for 2 weeks for the MAIN library, using the “LATE_HOLDS” notice template

Talking Tech

Per ulteriori informazioni sulla configurazione di questo prodotto di terzi si veda il capitolo :ref:`Talking Tech <talking-tech-label>.

Inviare il file delle notifiche

Script path: misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl

Che cosa fa: script che genera i file di avvisi in uscita Spec C per il sistema di notifica telefonico Talking Tech i-tiva.

Required by: TalkingTechItivaPhoneNotification

Frequenza consigliata: notturna

Ricevere il file delle notifiche

Script path: misc/cronjobs/thirdparty/TalkingTech_itiva_inbound.pl

Che cosa fa: elabora il file Results ricevuto dal sistema di notifica telefonico Talking Tech i-tiva

Required by: TalkingTechItivaPhoneNotification

Frequenza consigliata: notturna

Avvisa gli utenti della scadenza

Script path: misc/cronjobs/membership_expiry.pl

Does: sends messages to warn patrons of their card expiration to the message queue cron. Can optionally renew patron accounts as well.

Requires: MembershipExpiryDaysNotice

Frequenza consigliata: notturna

PARAMETERS

  • --man

    • Prints the manual page and exits.

  • --help

    • Prints a brief help message and exits.

  • -v

    • Verbose.

    • Without this flag set, only fatal errors are reported.

  • -n

    • Do not send any email. Membership expiry notices that would have been sent to the patrons are printed to standard out.

  • -c

    • Confirm flag: Add this option. The script will only print a usage statement otherwise.

  • -branch

    • Optional branchcode to restrict the cronjob to that branch.

  • -before

    • Optional parameter to extend the selection with a number of days BEFORE the date set by the MembershipExpiryDaysNotice system preference.

  • -after

    • Optional parameter to extend the selection with a number of days AFTER the date set by the MembershipExpiryDaysNotice system preference.

    • For example, --before 100 --after 100 will notify patrons who have accounts expiring within a date range of 100 days before and 100 days after the MembershipExpiryDaysNotice system preference.

  • -where

    • Use this option to specify a condition. Add «me» (alias) followed by the column name from the borrowers table.

    • For example:

      • --where="me.categorycode !='YA'" will notify patrons from categories other than “YA”

      • --where="me.categorycode = 'S'" will notify patrons from the category “S” only

      • --where 'me.lastseen IS NOT NULL' will only notify patrons who have been seen.

  • -letter

    • Optional parameter to use another notice than the default: MEMBERSHIP_EXPIRY

  • -letter_renew

    • Optional parameter to use another renewal notice than the default: MEMBERSHIP_RENEWED

    Version

    The -letter_renew parameter was added in Koha version 23.11.

  • -active

    • Followed by a number of months.

    • Optional parameter to include active patrons only (active within passed number of months).

    • This parameter needs the TrackLastPatronActivityTriggers system preference.

    • Cannot be used with -inactive below, the two parameters are mutually exclusive

    Version

    The -active parameter was added in Koha version 23.11.

  • -inactive

    • Followed by a number of months.

    • Optional parameter to include inactive patrons only (inactive since passed number of months).

    • This parameter needs the TrackLastPatronActivityTriggers system preference.

    • Cannot be used with -active above, the two parameters are mutually exclusive

    Version

    The -inactive parameter was added in Koha version 23.11.

  • -renew

    • Optional parameter to automatically renew patrons instead of sending them an expiry notice.

    • They will be informed by a membership renewal notice (the default MEMBERSHIP_RENEWED or a custom one specified by -letter_renew)

    Version

    The -renew parameter was added in Koha version 23.11.

ESEMPI DI USO

membership_expiry.pl -c

Will generate MEMBERSHIP_EXPIRY notices for patrons whose membership expires in the number of days set in MembershipExpiryDaysNotice.

membership_expiry.pl -c -renew

Will renew patrons whose membership expires in the number of days set in MembershipExpiryDaysNotice, and generate MEMBERSHIP_RENEWED notices for them.

membership_expiry.pl -c -renew -letter_renew PATRON_RENEWAL

Will renew patrons whose membership expires in the number of days set in MembershipExpiryDaysNotice, and generate the custom «PATRON_RENEWAL» notices for them. A «PATRON_RENEWAL» notice would have to have been created in the notices and slips tool beforehand.

membership\_expiry.pl -c -before 30

Will generate MEMBERSHIP_EXPIRY notices for patrons whose membership expires 30 days before the number of days set in MembershipExpiryDaysNotice.

membership_expiry.pl -c -renew -active 3

Will renew patrons whose membership expires in the number of days set in MembershipExpiryDaysNotice, and who have been active in the last three months («activity» is determined by the TrackLastPatronActivityTriggers system preference), and generate MEMBERSHIP_RENEWED notices for them.

membership_expiry.pl -c -inactive 6 -letter INACTIVE_PATRON

Will generate the custom «INACTIVE_PATRON» notices for patrons whose membership expires in the number of days set in MembershipExpiryDaysNotice, and who have been inactive for the last six months («activity» is determined by the TrackLastPatronActivityTriggers system preference). An «INACTIVE_PATRON» notice would have to have been created in the notices and slips tool beforehand.

In elaborazione/Lista libri

Script path: misc/cronjobs/cart_to_shelf.pl

Che cosa fa: assegna la collocazione permanente a tutti gli elementi che hanno la collocazione CART

Required by: NewItemsDefaultLocation, UpdateItemLocationOnCheckin, and UpdateItemLocationOnCheckout system preferences.

Frequenza consigliata: oraria

Catalogo

Webservice Batch per l’import

Script path: misc/cronjobs/import_webservice_batch.pl

Che cosa fa: è un cron job per elaborare code batch di importazione di tipo “webservice”. I batch possono essere elaborati anche attraverso l’interfaccia staff.

Nota

Questo script si usa per OCLC Connexion

Demone di importazione Connexion

Script path: misc/bin/connexion_import_daemon.pl

Che fa: è un demone che ascolta le richieste di OCLC Connexion e segue le specifiche OCLC Gateway. Prende richieste di MARC XML e usa un file di configurazione per i parametri di import batch e li gira a svc/import_bib

Nota

Questo script si usa per OCLC Connexion

Cancellazione batch di copie

Script path: misc/cronjobs/delete_items.pl

Does: generates a query against the items database and deletes the items matching the criteria specified in the command line arguments. A lightweight batch deletion tool for items, suitable for running in a cron job.

PARAMETERS

  • --help

    • Prints a brief help message.

  • --man

    • Prints the manual, with examples.

  • --verbose

    • Prints the «WHERE» clause generated by the collected --where arguments, as well as items affected to Standard Out.

    • The item information printed is

      • itemnumber

      • barcode

      • title

  • --where

    • The following argument must be a syntactically valid SQL statement which is part of the WHERE clause querying the items table.

    • Repeatable. If there are multiple --where parameters, they will be joined by AND.

  • --commit

    • No items will be deleted unless this parameter is present.

ESEMPI DI USO

delete_items.pl --where "items.withdrawn != 0" --where "items.withdrawn_on < $(date --date="13 month ago" --rfc-3339=date)" --commit

This will delete items where the withdrawn status is not zero AND where the withdrawn date is older than 13 months ago.

delete_items.pl --where "itemlost >= '1'" --where "itemlost <='4'" --where "itemlost_on < '2014-04-28'" --commit

This will delete items where the lost status is between 1 and 4 (inclusively) AND that were lost before 2014-04-28.

Check URL quick

Script path: misc/cronjobs/check-url-quick.pl

Nota

This script replaces the deprecated check-url.pl script

Does: checks URLs from biblio records; scans all URLs found by default in 856$u of bibliographic records and displays if resources are available or not.

PARAMETERS

  • –host=http://default.tld Server host used when URL doesn’t have one, i.e. doesn’t begin with “http:”. For example, if –host=mylib.com, then when 856$u contains “img/image.jpg”, the url checked is: http://www.mylib.com/image.jpg.

  • –tags Tags containing URLs in $u subfields. If not provided, 856 tag is checked. Multiple tags can be specified, for example:

    check-url-quick.pl –tags 310 410 856

  • –verbose|v Outputs both successful and failed URLs.

  • –html Formats output in HTML. The result can be redirected to a file accessible by http. This way, it’s possible to link directly to the bibliographic record in edit mode. With this parameter –host-intranet is required.

  • –host-intranet=http://koha-pro.tld Server host used to link to bibliographic record editing page in Koha intranet interface.

  • –timeout=10 Timeout for fetching URLs. By default 10 seconds.

  • –maxconn=1000 Number of simultaneous HTTP requests. By default 200 connections.

Delete records via leader

Script path: misc/cronjobs/delete_records_via_leader.pl

Does: attempts to delete any MARC records where the leader character 5 equals “d”.

PARAMETERS

  • -c|–confirm Script will do nothing without this parameter

  • -v|–verbose Verboso

  • -t|–test Test mode, does not delete records. Test mode cannot determine if a record/item will be deleted successfully, it will only tell you what records and items the script will attempt to delete.

  • -i|–delete-items Try deleting items before deleting record. Records with items cannot be deleted.

Update authorities

Script path: misc/cronjobs/merge_authorities.pl

Does: updates biblio data with changes to authorities records

Nota

Il nome di questo script è fuorviante: il programma non fonde inisieme le autorità; invece, fonde i dati delle autorità con i record bibliografici collegati. Le modifiche ai record di atuorità saranno applicate ai record bibliografici che usano quelle autorità nel momento in cui si esegue lo script.

Required by: AuthorityMergeLimit system preference

Frequenza consigliata: notturna

Serials update

Script: misc/cronjobs/serialsUpdate.pl

Che cosa fa: verifica se è presente un’uscita «in ritardo» sugli abbonamenti attivi; se c’è, la marca come ritardataria ed aggiunge la successiva come attesa.

Frequenza consigliata: notturna

Forza l’aggiornamento.

Script path: misc/cronjobs/automatic_item_modification_by_age.pl

Does: updates items based on the list of rules set forth in the Automatic item modifications by age tool

Required by: Automatic item modifications by age

Frequenza consigliata: notturna

Stock rotation

Script path: misc/cronjobs/stockrotation.pl

Does: moves items from one stock rotation stage to the next, if they are available for processing.

Each library will receive a report with «items of interest» for them for today’s rota checks. Each item there will be an item that should, according to Koha, be located on the shelves of that branch, and which should be picked up and checked in.

Nota

The email sent is based on the SR_SLIP template. It can be customized in the Notices and slips tool.

The item will either:

  • have been placed in transit to their new stage library;

  • have been placed in transit to be returned to their current stage library;

  • have just been added to a rota and will already be at the correct library;

Upon check-in,

  • items that need to be transferred elsewhere will be put in transit and a message will pop up requesting the item be sent to their new branch.

  • items that are already at the correct library will be checked in and no message will pop up.

Required by: Stock rotation tool

Frequenza consigliata: notturna

PARAMETERS

  • -a|–admin-email

    • An address to which email reports should also be sent

    • This is an additional email address to which all email reports will be sent, in addition to sending them to branch email addresses.

  • -b|–branchcode

    • Select branch to report on for “email” reports (default: all)

    • If the “email” report is selected, you can use the “branchcode” parameter to specify which branch’s report you would like to see.

    • The default is “all”.

  • -x|–execute

    • Actually perform stockrotation housekeeping

    • By default, this script merely reports on the current status of the stock rotation subsystem. In order to actually place items in transit, the script must be run with the “execute” argument.

  • -r|–report

    • Select either “full” or “email”

    • The “report” argument allows you to select the type of report that will be emitted.

    • The default is “full”.

    • If the “email” report is selected, you can use the “branchcode” parameter to specify which branch’s report you would like to see.

  • -S|–Send-all

    • Send email reports even if the report body is empty

    • This argument causes even reports with an empty body to be sent.

  • -s|–send-email

    • Send reports by email

    • This argument causes the script to send reports by email.

  • -h|–help

    • Display the help message

OPAC

RSS feeds

Script: misc/cronjobs/rss/rss.pl

Does: produces an RSS XML document for any SQL query (not used for search results RSS feed). Learn more.

Frequenza consigliata: oraria

Authorities browser

Script path: misc/cronjobs/build_browser_and_cloud.pl

Does: generates content for authorities browse in OPAC

Required by: OpacBrowser system preference

Importante

Questa preferenza ed il realtivo cron job devono essere utilizzati solo su sistemi in Francese.

Subject/author clouds

Script: misc/cronjobs/cloud-kw.pl

Does: generates HTML keywords clouds from Koha Zebra indexes. misc/cronjobs/cloud-sample.conf has a sample of how this script operates.

Frequenza: questo è il tipo di script che si può eseguire una volta al mese o giù di lì; il contenuto prodotto non cambia moltissimo con l’andar del tempo.

System administration

Services throttle

Script path: misc/cronjobs/services_throttle.pl

Esegue: reimposta i servizi basati su xISBN

Frequenza consigliata: notturna

Clean up database

Script path: misc/cronjobs/cleanup_database.pl

Does: truncates the sessions table, cleans out old zebraqueue entries, action logs and staged MARC files.

Vedi lo schema del database in http://schema.koha-community.org/

PARAMETERS - –del-exp-selfreg

  • –del-unv-selfreg DAYS

    • Delete all unverified self registrations in borrower_modifications older than DAYS.

  • –deleted-catalog DAYS

    • Purge bibliographic records deleted more than DAYS days ago from tables deletedbiblio, deletedbiblio_metadata, deletedbiblioitems and deleteditems.

  • –deleted-patrons DAYS

    • Purge patrons deleted more than DAYS days ago from the deletedborrowers table.

  • –fees DAYS

    • Purge entries in the accountlines table older than DAYS days, where the amountoutstanding is 0 or NULL.

    • In the case of –fees, DAYS must be greater than or equal to 1.

  • -h|–help

    • Get help message

  • –import DAYS

    • Purge entries from import tables older than DAYS days.

    • This includes import_batches, import_biblios, import_items, import_record_matches and import_records.

    • In import_batches, the batches that are the result of Z39.50 searches are removed with the –z3950 parameter.

    • Defaults to 60 days if no days specified.

  • --list-invites

    GIORNI

    • Purge (unaccepted) list share invites from the virtualshelfshares table older than DAYS days

    • Defaults to 14 days if no days specified.

  • –logs DAYS

    • Purge entries from the action_logs table older than DAYS days.

    • Defaults to 180 days if no number of days specified.

  • –log-modules

  • –preserve-logs

  • -m|–mail DAYS

    • Purge entries from the message_queue table that are older than DAYS days.

    • Defaults to 30 days if no days specified.

  • –merged

    • Purge completed entries from the need_merge_authorities table.

  • –oauth-tokens

    • Delete expired OAuth2 tokens

  • –old-issues DAYS

    • Purge checkouts returned more than DAYS days ago from the old_issues table.

  • –old-reserves DAYS

    • Purge holds more than DAYS old from the old_reserves table.

  • –restrictions DAYS

    • Purge patrons restrictions from the borrower_debarments table expired since more than DAYS days.

    • Defaults to 30 days if no days specified.

  • –return-claims

  • –all-restrictions

    • Purge all expired patrons restrictions from the borrower_debarments table.

  • –searchhistory DAYS

    • Purge entries from the search_history table older than DAYS days.

    • Defaults to 30 days if no days specified

  • –sessions

    • Purge the sessions table.

    • If you use this while users are logged into Koha, they will have to reconnect.

  • –sessdays DAYS

    • Purge only sessions older than DAYS days.

  • –statistics DAYS

    • Purge entries from the statistics tables that are more than DAYS days old.

  • –temp-uploads

    • Delete temporary uploads from the uploaded_files table older than the number of days specified in the UploadPurgeTemporaryFilesDays system preference.

  • –temp-uploads-days DAYS

  • –transfers DAYS

    • Purge transfers completed more than DAYS days ago from the branchtransfers table.

  • –unique-holidays DAYS

    • Delete all unique holidays from the special_holidays table older than DAYS

  • –uploads-missing FLAG

    • Delete upload records for missing files when FLAG is true, count them otherwise

  • -v|–verbose

    • verbose mode

  • –zebraqueue DAYS

    • Purge completed zebraqueue entries older than DAYS days.

    • Defaults to 30 days if no days specified.

  • –z3950

    • Purge records from import tables that are the result of Z39.50 searches.

    • To purge all other import information, see the –import parameter above.

Share usage stats

Script path: misc/cronjobs/share_usage_with_koha_community.pl

Does: sends your info to the Hea website if you’re sharing information via the UsageStats feature

Frequenza: mensile

Search for data inconsistencies

Script path: misc/maintenance/search_for_data_inconsistencies.pl

Does: reveals problems in data, such as

Some of these issues can cause problems in circulation or catalog search, so it’s important that they be corrected.

There is no suggested frequency. This is a tool to be used when needed.

Acquisizioni

Cancella i suggerimenti più vecchi

Script path: misc/cronjobs/purge_suggestions.pl

Does: removes old suggestions from the suggestion management area.

PARAMETERS

  • help|?

    Show help message

  • days

    Define the age of suggestions to be deleted, based on “managed on” date

    Nota

    The system preference PurgeSuggestionsOlderThan can also be used to define the number of days used in the script. If using the system preference, don’t use the “days” parameter.

    Nota

    The number of days is based on the “managed on” date of the suggestion.

  • confirm

    This parameter is mandatory for the script to run.

Invia per email i suggerimenti da elaborare

Script path: misc/cronjobs/notice_unprocessed_suggestions.pl

Does: generates a notice to the fund owner that there are suggestions in need of processing

EDI message processing

Script path: misc/cronjobs/edi_cron.pl

Does: sends and received EDI messages

Frequenza: ogni 15 minuti

Remove temporary EDI files

Script path: misc/cronjobs/remove_temporary_edifiles.pl

Esegue: rimuove i file temporanei dell’EDI più vecchi di 5 giorni

E-resource management (ERM)

Harvesting cron job

Script path: /misc/cronjobs/erm_run_harvester.pl

Does: this script will run the SUSHI harvesting for any Active usage data providers set up in the E-resource management module.

Frequency: it is recommended you set it up to run at a regular interval (e.g., every month since providers usually produce statistics data monthly).

PARAMETERS

  • --help or -h

    • Prints a help message

  • --begin-date

    • Set the start date for the harvest in yyyy-mm-dd format (e.g.: “2023-08-21”)

  • --end-date

    • Set the end date for the harvest in yyyy-mm-dd format (e.g.: “2023-08-21”)

  • --dry-run

    • Produces a run report, without actually doing anything permanent

  • --debug

    • Prints additional debugging information during the run

USAGE EXAMPLE

erm_run_harvester.pl --begin-date 2023-06-21 --debug

Will run the SUSHI harvest for Active usage data providers for the period starting 21 June 2023 to the present date (or to the date for which data is available). Additional debugging information about the way the harvest has run will be displayed.

Reports

Run report

Script path: misc/cronjobs/runreport.pl

Does: runs pre-existing saved reports, optionally sends the results by email.

PARAMETERS

  • -h | --help

    • Displays help message

  • -m | --man

    • Displays full documentation

    • Same as --help --verbose

  • -v | --verbose

    • Verbose output

    • Without this parameter, only fatal errors are reported

  • --format=s

    • Selects output format

    • Possible values:

      • text

      • html

      • csv

      • tsv

    • At the moment, “text” and “tsv” both produce tab-separated output

    • Defaults to “text”

  • -e | --email

    • Send the output by email (implied by --to or --from)

  • --send_empty

    • Send the email even if the report returns no results

    Version

    The --send_empty parameter was added in Koha version 23.11.

  • -a | --attachment

    • Attach the report as a file

    • Cannot be used with html format

  • --username

    • Username to pass to the SMTP server for authentication

  • --password

    • Password to pass to the SMTP server for authentication

  • --method

    • The type of authentication, i.e. LOGIN, DIGEST-MD5, etc.

  • --to=s

    • E-mail address to which to send report results

    • If --email is specified, but --to is not, the address in KohaAdminEmailAddress is used

  • --from=s

    • E-mail address from which to send report

    • If --email is specified, but --from is not, the address in KohaAdminEmailAddress is used

  • --subject=s

    • Subject for the e-mail

  • --param=s

    • Pass value for the runtime parameter

    • Repeatable

    • Provide one --param per runtime parameter requested for the report. Report parameters are not combined as they are on the staff side, so you may need to repeat parameters.

  • --separator=s

    • Separator character

    • Only for csv format

    • Defaults to comma

  • --quote=s

    • Quote character

    • Only for csv format

    • Defaults to double quote

    • Empty string is allowed

    Version

    The --quote parameter was added in Koha version 23.11.

  • --store-results

  • --csv-header

    • Add column names as first line of csv output

ARGUMENTS

  • reportID

    • Report ID Number from saved_sql.id

    • Multiple ID’s may be specified

    • Mandatory

ESEMPI DI USO

runreport.pl 1

Will output results from report 1 in the terminal (STDOUT).

runreport.pl 1 5

Will output results from reports 1 and 5 in the terminal (STDOUT).

runreport.pl --format html --to admin@myDNSname.org 1

Will send results from report 1 to admin@myDNSname.org in HTML format.

runreport.pl --format html --to admin@myDNSname.org --param CPL --param FICTION 1

Will send results from report 1 to admin@myDNSname.org in HTML format. “CPL” will be passed to the first runtime parameter, and “FICTION” will be passed to the second runtime parameter.

runreport.pl --store-results 1

Will save the report results in the saved_reports database table, and they will be available from the staff interface in Reports > Guided reports > Saved report.

Social data

Ricevi i social data

Script path: misc/cronjobs/social_data/get_report_social_data.pl

Fa: scarica i dati da Babelthèque per aggiungerli ai record dell’Opac

Frequenza consigliata: notturna

Aggiorna i social data

Script path: misc/cronjobs/social_data/update_social_data.pl

Fa: aggiorna i records dell’Opac con i social data di Babelthèque

Demoni

Daemons are continuously running tasks that help support Koha operation. Your database and web-server are run as daemons. Newer versions of Koha start two different daemons for most koha instances:

  • zebra - il server di indicizzazione (ndt: salvo usare Elasticsearch)

  • koha-indexer - this daemon updates the index server with new and modified data (biblios and authorities)

Questi demoni sono lanciati dallo script /etc/init.d/koha-common.

Demone indicizzatore di Zebra

Percorso dello script: /usr/sbin/koha-indexer (invocato da /etc/init.d/koha-common)

The koha-indexer script invokes rebuild_zebra.pl in daemon mode. In this mode, the script will run continuously and check the database for new or modified data every 30 seconds. New or modified records are then sent to Zebra for indexing, which only takes a second or so. The advantage of this approach is a search system which is much more responsive to changes, compared to the cron job approach.

Script di uso sconsigliato:

Questi non dovrebbero essere eseguiti senza modifiche:

Script path: misc/cronjobs/update_items.pl

Script: misc/cronjobs/smsoverdues.pl

Script: misc/cronjobs/notifyMailsOp.pl

Script: misc/cronjobs/reservefix.pl

Script path:misc/cronjobs/zebraqueue_start.pl