Projekti

Yleinen

Profile

Crontab

Esimerkki crontabista (Vaski)

# Cronjobien kuvaukset: https://tiketti.koha-suomi.fi/projects/koha-suomen-dokumentaatio/wiki/Crontab
# Cron-rivien formaatti on: min hour dom mon dow command. (minuutti, tunti, kuukaudenpäivä, kuukausi, viikonpäivä)

### SET ENV ###
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 

KOHA_CONF=/etc/koha/koha-conf.xml
KOHA_PATH=/home/koha/Koha
PERL5LIB=/home/koha/Koha

TRIGGER=/home/koha/Koha/misc/cronjobtimer.sh
MAILTO="" 

#### Indexing ####
# Update Zebra indices every five minutes and sync Zebra tmpfs indices to disk
# after closing the library + clean up old Zebra tempfiles
# */05 06-21 * * *  $TRIGGER cronjobs/zebratmpfs reindex
# 30 23 * * *       $TRIGGER cronjobs/zebratmpfs synctodisk
# 01 00 * * *       $TRIGGER cronjobs/clean_zebra_temps.sh

# Uncomment this for complete Zebra rebuild. This will also sync to disk, so comment the above!
# 10 23 * * *       $TRIGGER cronjobs/zebratmpfs newindex

# Uncomment this for complete ElacticSearch rebuild
# 10 23 * * *       $TRIGGER search_tools/rebuild_elastic_search.pl -a -b -c 1000 -d

#### ELASTICSEARCH INDEXING ####

#### Indexing ####
# Sync index to disk every night
  00 23 * * * /usr/local/bin/elastictmpfs synctodisk >> /var/log/koha/elastictmpfs.log 2>&1

#### Circulation & Holds ####
  01 00 * * *       $TRIGGER cronjobs/fines.pl -v -l -o /var/log/koha/fines
  10 00 * * *       $TRIGGER cronjobs/holds/cancel_expired_holds.pl -v 3
  15 00 * * *       $TRIGGER cronjobs/holds/auto_unsuspend_holds.pl
  20 00 * * *       $TRIGGER cronjobs/cart_to_shelf.pl --hours 1
  */1 07-22 * * *   $TRIGGER cronjobs/holds/build_holds_queue.pl
  */1 07-22 * * *   $TRIGGER cronjobs/holds/update_holds_to_pull.pl

#### Patrons ####
  01 00 * * *       $TRIGGER cronjobs/j2a.pl -v -f LAPSI -t HENKILO
  30 00 * * *       $TRIGGER cronjobs/delete_expired_opac_registrations.pl -c
  */5 07-22 * * *   $TRIGGER cronjobs/manageExpiredAccounts.pl VIRKAILIJA
  */5 07-22 * * *   $TRIGGER cronjobs/reset_failed_logins.pl 3300 VIRKAILIJA
# 05 00 1 1 *       $TRIGGER cronjobs/turnofftheyearBlockBorrowersWithFines.pl -v -y $(($(date +\%Y)-1)) -c
# 55,25 08-20 * * * $TRIGGER cronjobs/mvssban.pl /home/koha/Koha/koha-tmpl/mv/patrons.xml
# 10 00 * * *       $TRIGGER cronjobs/dropssban.pl --confirm

#### Notices ####
  */15 09-19 * * *  $TRIGGER cronjobs/process_message_queue.pl
  00 20 * * *       $TRIGGER cronjobs/process_message_queue.pl
  40 08 * * *       $TRIGGER cronjobs/advance_notices.pl -c
  00 09 * * *       $TRIGGER cronjobs/overdue_notices.pl -letternumbers 12 -t -p -s
# 10 09 * * *       $TRIGGER cronjobs/membership_expiry.pl -c -v
  50 20 * * *       $TRIGGER cronjobs/pate.pl --letters

#### Billing ####
# ProE every wednesday, Lastu every first wednesday of an odd month. 
# 30 10 * * 3       $TRIGGER cronjobs/runBilling.pl 60 OULULA
# 55 10 * * 3       $TRIGGER cronjobs/runBilling.pl 60 RAAHELA
# 00 15 * * 3       test $(date +\%-d) -le 7 && test $(($(date +\%-m) \% 2)) -eq 1 && /home/koha/misc/bin/runlastu.sh

#### Acquisition ####
  */1 06-22 * * *   $TRIGGER cronjobs/runEditXImport.pl
  30 05 * * *       $TRIGGER cronjobs/notify-failed-editx.sh

#### Catalog ####
# 30 00 * * *       $TRIGGER cronjobs/purge_suggestions.pl -days 365
# 10 00 * * *       $TRIGGER cronjobs/merge_authorities.pl -b -v
  00 04 * * *       $TRIGGER cronjobs/update_totalissues.pl --incremental --use-stats
# 10 00 * * *       cd /home/koha/marc21-fi-mangle && ./luo_virhelista.sh
# 15 00 1 * *       cd /home/koha/marc21-fi-mangle && ./get_fi_xmls.sh && ./update_frameworks_VASKI.sh
# 20 00 1 * *       /home/koha/Koha/misc/get_marc21_formatchecker_data_fi.sh
# */05 07-21 * * *  $TRIGGER cronjobs/broadcastBiblios.pl -a -i Vaski --identifier -c 5
  */02 07-21 * * *   $TRIGGER cronjobs/runBroadcastBiblios.pl -a -i Vaski -c 5 --identifier --start_time 9 --block_component_parts

#### System administration & statistics ####
# 00 06 * * 7       $TRIGGER cronjobs/cleanup_database.pl --sessdays 7 --zebraqueue --mail 60 --merged --import --logs --searchhistory
  50 22 28 * *      $TRIGGER cronjobs/share_usage_with_koha_community.pl -v
  10 01 * * *       $TRIGGER cronjobs/update_biblio_data_elements.pl --verbose 2
  10 02 1 1 *       $TRIGGER statistics/generateOKMAnnualStatistics.pl --timeperiod 'lastyear' -r -v
  10 03 1 1 *       $TRIGGER statistics/generateOKMAnnualStatistics.pl --timeperiod 'lastyear' --individual '_A' -r -v
  10 04 1 * *       $TRIGGER statistics/generateOKMAnnualStatistics.pl --timeperiod 'lastmonth' --individual '_A' -r -v
# 31 08 19 08 *     $TRIGGER statistics/generateOKMAnnualStatistics.pl --timeperiod '06' -r -v

# Restart plack, apache + clear memcache and template-cache nightly via koha-autoreload daemon
  00 04 * * *       touch /home/koha/Koha/.git/FETCH_HEAD

#### Dumps and backups ####
  00 7-22 * * *     $TRIGGER cronjobs/dumpdb --variable-data
  00 23 * * *       $TRIGGER cronjobs/dumpdb
  30 23   * * *     sudo /usr/local/bin/ksbackup --dirs    >> /var/log/koha/ksbackup.log 2>&1
  50 23   * * *     sudo /usr/local/bin/ksbackup --indices >> /var/log/koha/ksbackup.log 2>&1

Tulkintaohjeita

# */05 06-21 * * *  $TRIGGER cronjobs/zebratmpfs reindex

Ajetaan joka päivä viiden minuutin välein 06-21 alkavina tunteina. Viimeinen ajo klo 21.55.
  30 05 * * *       $TRIGGER cronjobs/notify-failed-editx.sh

Ajetaan joka päivä klo 5.30.
  50 22 28 * *      $TRIGGER cronjobs/share_usage_with_koha_community.pl -v

Ajetaan kuukauden 28. päivä klo 22.50
# 05 00 1 1 *       $TRIGGER cronjobs/turnofftheyearBlockBorrowersWithFines.pl -v -y $(($(date +\%Y)-1)) -c

Ajetaan 1.1. klo 00.05.