工作排程與守護行程

Koha 由許多後台任務支援. 這些任務可以是定期執行的任務 (工作排程),也可以是稱為守護行程的持續運行的任務.

工作排程是安排自動伺服器裡的指令或腳本以完成指定工作的 Linux 指令。以工作排程方式執行的腳本通常是修改檔案或資料庫;然而,它們也可以執行其他不需修改伺服器資料的工作,像是送出電子郵件通知。

daemon 是 Linux 命令,系統啟動後就開始執行,並持續在背景執行若干功能。Koha 用到的資料庫 (MYSQL 或 MariaDB) 及網頁伺服器 (通常是 Apache),就是一種 daemon。

Koha 有許多可以啟用的工作排程 (搜尋引擎索引、產生逾期通知、清除資料等) 和一些守護行程. 本章將為您說明這些內容.

Crontab 範例

Koha crontab 在 misc/cronjobs/crontab.example

此範例包括 boilerplate 工作排程款目的樣本。

工作排程

檔案中的位置假設是開發安裝,其中檔案位於雜項中/ 相對於 git root 借出. 如果您使用 Debian 軟體包安裝或從原始程式碼進行標準安裝,您將需要在 /usr/share/koha/bin/ 中尋找檔案.

其他位置也可以採用其他安裝方法. 如果它們不在這些目錄中,您可以執行簡單的查找搜尋.

备注

對於任何使用 Debian 軟體包具有 shell 存取權限的人來說,以下命令是查找 Debian 軟體包安裝的檔案的簡單方法:

dpkg -L koha-common

這提供了 koha-common 套裝安裝的檔案的完整清單. 然後您可以輕鬆地從那裡找到該檔案

備份

每日備份

腳本路徑:misc/cronjobs/backup.sh

做:新增 Koha 資料庫逐日備份。

刊期建議:日刊

流通

預約佇列

腳本路徑:misc/cronjobs/holds/build_holds_queue.pl

做:更新預約順位報表

必須用到:預約順位報表

建議頻率:每 1-4 小時

描述:

  • 應定期執行腳本若您的圖書館系統允許讀者預約在架的館藏。此腳本決定負責滿足此預約的圖書館。

    由系統偏好 StaticHoldsQueueWeightRandomizeHoldsQueueWeight 共同控制其行為。

    不讓所有圖書館參與館藏滿足預約計畫,應列出*要*參加該計畫的圖書館,包括圖書館的條碼,並以逗點區隔(如:"MPL,CPL,SPL,BML" 等)。

    預設,預約順位將先列入提取圖書館。若無法滿足,則 build_holds_queue.pl 將取用 StaticHoldsQueueWeight 設定的圖書館。若停用 RandomizeHoldsQueueWeight (預設值為停用),則依 StaticHoldsQueueWeight 偏好設定的圖書館順序,逐一取用。

    例如,系統內有三個規模不一的圖書館(大型、中型與小型),希望由大型圖書館承擔較多的預約責任,StaticHoldsQueueWeight偏好應設為"LRG,MED,SML"。

    若期望各圖書館平均分擔預約的任務,應啟用RandomizeHoldsQueueWeight偏好,將隨機將預約分配給各圖書館。

預約過期

腳本路徑:misc/cronjobs/holds/cancel_expired_holds.pl

執行: 取消用戶設定到期日的預約. 如果圖書館使用 ExpireReservesMaxPickUpDelay 和 :ref:`ExpireReservesMaxPickUpDelayCharge <ExpireReservesMaxPickUpDelayCharge-label>`偏好,則此腳本還將取消在預約書架上放置時間過長的預約,並且 (如果圖書館這樣做) 將向讀者收取未預約的費用.

可以使用 --原因參數增加取消原因。使用 HOLD_CANCELLATION 權威值類型 中取消代碼

刊期建議:日刊

取消預約

腳本路徑:misc/cronjobs/holds/auto_unsuspend_holds.pl

執行: 檢查以尋找不再暫停的預約,如果 :ref:`AutoResumeSuspishedHolds <AutoResumeSuspishedHolds-label>`偏好設定為 '允許' ,則刪除暫停. 這將使讀者回到暫停預約時所在的序列.

刊期建議:日刊

罰款

腳本路徑:misc/cronjobs/fines.pl

做: 計算和收取(或遞增)逾期罰款每館藏對讀者帳號。罰款計算使用寬限期已處理,罰款間隔, 罰款總數和其它參數從:ref:circulation and fines rules <circulation-and-fines-rules-label>.

需要: finesMode 系統偏好

建議頻率:每晚

說明 若 Koha 系統偏好 'finesMode' 已設為 'production',則向讀者收取罰款。若設為 'test',則計算罰款但不收取。

說明 假日不計入罰款。

參數 - -h|--help

  • 取得協助資訊

  • -l|--log

    • 記錄匯出至檔案 (如果提供 -o 參數)

  • -o|--out

    • 為記錄匯出資料夾 (預設是 env 或 /tmp 如果資料夾不存在)

  • -v|--verbose

    • verbose 模式

  • -m|--maxdays

    • 逾期多少天來處理

    • 這可以透過簡單地處理的記錄數量來提高性能。考慮到流通政策通常會在幾天後將罰款限制在最高限額,因此將處理的逾期款項限制在逾期 X 天以內是安全的。

固定罰款

腳本路徑:misc/cronjobs/staticfines.pl

做: 針對目前未付的讀者對任何/所有逾期收取單獨一定的罰款.費用由讀者類型每指令行定義或將使用流通規則針對讀者未付的最長逾期館藏(只針對第一個罰款期間)。一旦收費,罰款是定額: 沒有新罰款會再加入直到現有罰款已完全付清。

建議頻率:每晚

說明 若 Koha 系統偏好 'finesMode' 已設為 'production',則向讀者收取罰款。若設為 'test',則計算罰款但不收取。

說明 假日不計入罰款。

批次註銷費用

腳本路徑: misc/cronjobs/writeoff_debts.pl

做: 沖銷讀者帳戶中的未付費用.

參數

备注

選擇要註銷的借款記錄選項是累積的. 例如,同時提供 --added_before--type 指定帳戶行必須滿足*兩個*條件才能選擇註銷.

备注

您必須至少使用其中一個過濾選項才能執行腳本. 這是為了防止意外的 '全部註銷' 操作.

  • -h | --help

    • 顯示協助訊息.

  • -v | --verbose

    • 詳細輸出.

  • --added-before

    • 註銷指定日期之前新增的費用.

    • 日期應採用 ISO 格式,例如 2013-07-19,並且可以使用 :code:`date -d '-3 month' --iso-8601`來產生.

  • --added-after

    • 註銷指定日期後新增的費用.

    • 日期應採用 ISO 格式,例如 2013-07-19,並且可以使用 :code:`date -d '-3 month' --iso-8601`來產生.

    版本

    Koha 版本 23.11 中新增了 --added-after 參數.

  • --category-code

    • 註銷屬於指定 類別 讀者的費用.

    • 可重複.

    版本

    Koha 版本 23.11 中新增了:code:--category-code 參數.

  • --type

  • --file

    • 註銷此檔案中每行作為一個傳遞 accountlines_id 的費用.

    • 如果定義了其他條件,它將僅註銷檔案中與這些條件相符的內容.

  • --confirm

    • 實際註銷費用需要此參數.

    • 運行不帶此參數的腳本將僅輸出將被註銷的費用.

USAGE EXAMPLES

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

將註銷 2023 年 6 月 20 日之後新增的費用.

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

將註銷 'K' 類別讀者超過 3 個月的費用.

Restrict patrons with fines

版本

This script was added to Koha in version 23.11.

Script path: misc/cronjobs/debar_patrons_with_fines.pl

Does: Adds a manual restriction to patrons with more than X amount in unpaid charges.

Frequency suggestion: nightly or depending on needs

參數

  • -h | --help

    • Displays the help message.

  • -a | --amount

    • Minimum amount the patron owes in order to be restricted.

    • Defaults to 0, meaning anyone who owes anything will be restricted.

  • -m | --message

    • Message to be added as the restriction comment.

  • -f | --messagefile

    • File that contains the message to be added as the restriction comment.

  • -e | --expiration

    • Expiration date for the restriction.

  • -c | --confirm

    • Use this parameter to confirm the changes.

    • Without this parameter, no patrons will be restricted.

  • -v | --verbose

    • Shows which patrons are affected.

USAGE EXAMPLES

debar_patrons_with_fines.pl -a 5 -m "Fines" -v

Will show which patrons have more than 5 in unpaid fees, but will not actually restrict them (missing --confirm parameter).

debar_patrons_with_fines.pl -a 5 -m "Fines" -e '2024-12-31' -v -c

Will restrict patrons who owe more than 5, the restriction will have the comment "Fines" and will expire on 2024-12-31. The script output will also show which patrons were restricted.

逾期太久

腳本路徑:misc/cronjobs/longoverdue.pl

做:允許更改不同程度的遺失館藏,並向讀者收取館藏記錄內的重置價格。

建議頻率:每晚

說明

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

追蹤借出總數

腳本路徑:misc/cronjobs/update_totalissues.pl

做:以最新的借出現況更新資料庫內 biblioitems.totalissues 欄位的內容。

建議頻率:每晚

警示

需考量資料庫伺服器與 Koha 伺服器的時間不同步的狀況,並使用 --since 參數取代 --interval 參數做為新增性更新的依據。

說明

如果有效能問題,可以使用此工作排程. 否則,請使用 UpdateTotalIssuesOnCirc 系統偏好.

產生讀者檔供離線流通之用

腳本路徑:misc/cronjobs/create_koc_db.pl

做:從 Koha 離線流通 工具產生 borrowers.db 檔案

建議頻率:每週

自動續借

腳本路徑:misc/cronjobs/automatic_renewals.pl

做:若在 流通與罰款規則 裡允許自動續借,將自動續借。

建議頻率:每晚

重要

為了正確執行,您必須使用 --confirm 參數, 否則它會在測試模式下執行

參數 - -h|--help

  • 取得協助資訊

  • --發送-通知

    • 如果執行了自動續借,寄送 AUTO_RENEWALS 通知給讀者

  • -v|--verbose

    • verbose 模式

  • -c|--confirm

    • 若沒有此參數則不會進行任何更改,腳本將以測試模式執行

    • 若沒有此參數,腳本也將預設為詳細模式

自動還入

腳本路徑:misc/cronjobs/automatic_checkin.pl

做:在借出期限後自動檢查館藏。這是在 :ref:`館藏類型級別<item-types-label>`設定的。

建議頻率:每晚

备注

Optionally, holds can be filled automatically when items are checked in with this script. This option is enabled with the AutomaticCheckinAutoFill system preference.

催還

到期催還

腳本路徑:misc/cronjobs/recalls/expire_recalls.pl

做:自動標記為逾期催還

  • 已被要求,但尚未履行且已逾期

  • 催還等待取件的時間長於 :ref:`流通規則<defining-circulation-rules-label>`中的取件時間或在 :ref:`RecallsMaxPickUpDelay <RecallsMaxPickUpDelay-label>`系統偏好中設定的時間段

建議頻率:每晚

逾期催還

腳本路徑:misc/cronjobs/recalls/overdue_recalls.pl

做:如果未在調整後的到期日歸還,則會將催還的館藏設定為逾期

建議頻率:每晚

讀者

批次刪除讀者

腳本路徑:misc/cronjobs/delete_patrons.pl

做:依照未曾借出日期、到期日、上網日期、屬性、或所屬圖書館,批次刪除讀者紀錄。

說明

應採用 ISO 格式的日期,如 2013-07-19,可以用指令產生 date -d '-3 month' "+%Y-%m-%d"。

重要

此選項是選擇讀者記錄去刪除 累積的。比方說,供應同為 --expired_before 以及 --library 指定特定讀者記錄必須吻合 同時 選擇刪除為條件。

參數

  • --not_borrowed_since 刪除到此日未曾借過書過的讀者

    警告

    如果使用此選項,所有舊借出都匿名的讀者將有一個空的流通歷史記錄並被刪除. 可能會發生匿名化,因為讀者的 borrowers.privacy = 2,透過 工作排程進行匿名化 或透過 讀者選擇在OPAC 中匿名化其歷史記錄.

  • --expired_before 刪除帳號失效日早過此日的讀者

  • --last_seen 刪除自該日期以來未連結的讀者. 必須啟用系統偏好 TrackLastPatronActivity 才能使用此選項.

  • --category_code 刪除此類讀者類型的讀者

  • --library 刪除此圖書館的讀者

  • -c|--confirm 此旗標心須提供以便程式能實際刪除讀者記錄。如果未提供,程式將呈報它將刪除的讀者記錄

  • -v|--verbose Verbose 模式.

匿名讀者資料

腳本路徑:misc/cronjobs/batch_anonymise.pl

做:用於匿名讀者資料。此腳本將從流通記錄裡移除讀者號,一方面保護讀者的隱私同時又保持原有的流通記錄。

更新讀者目錄

腳本路徑:misc/cronjobs/update_patrons_category.pl

做:將符合條件的讀者的讀者類型更新為另一個指定的讀者類型。當兒童讀者達到 讀者類型 中定義的年齡上限時,這可用於將兒童讀者從兒童讀者類型轉換為成人讀者類型。

此腳本用以重置 j2a.pl script。

建議頻率:每晚

DESCRIPTION

此腳本設計為使用命令行參數指定的標準將讀者從一個類型更新到另一個類型。

參數

  • --too_old 更新,如果讀者超過其當前 讀者類型 的年齡上限。

  • --too_young 更新,如果讀者低於他們 讀者類型 的最低年齡限制。

  • 如果讀者帳號的罰款總額超過 X,--fo=X|--fineover=X 更新。

  • 如果讀者帳號的罰款總額低於 X,--fu=X|--fineunder=X 更新。

  • --rb=date|regbefore=日期更新,如果讀者的註冊日期早於給定日期。

  • --ra=date|regafter=日期更新,如果讀者的註冊日期晚於給定日期。

  • -d --field name=值如果符合給定條件,則更新。 <name> 必須替換為 borrowers 表單的分欄。如果欄位的內容等於 <value>,則符合條件。

  • --where <conditions> 如果符合 SQL <where> 語法,則更新。

  • -v|--verbose 詳細模式:若未有此旗標,只回報嚴重的錯誤。

  • -c|--confirm 送出對資料庫的更改。除非將此參數新增到命令中,否則不會進行任何更改。

  • -b|--branch <branchcode> 更新,如果讀者的所屬圖書館與給定的 <branchcode> 匹配。

  • -f|--form <categorycode> 更新,如果讀者當前有這個讀者類型。

  • -t|--to <categorycode> 將符合條件的讀者更新為該讀者類型。

USAGE EXAMPLES

"update_patrons_category.pl"

"update_patrons_category.pl" -b=<branchcode> -f=<categorycode> -t=<categorycode> -c"處理單一分館,並逐一更新讀者類型)

"update_patrons_category.pl" -f=<categorycode> -t=<categorycode> -v" (處理所有分館、顯示全部訊息、回報受影響的讀者。不更動資料庫)

更新讀者的訊息偏好

腳本路徑:misc/maintenance/borrowers-force-messaging-defaults.pl

做:將讀者的訊息偏好更新為 :ref:`讀者類型<patron-categories-label>`中設定的預設值。

增加新讀者 或當 :ref:`使用讀者匯入工具<patron-import-label> 匯入讀者時,會自動設定預設訊息偏好,但是,如果您直接在資料庫中匯入讀者,則不會設定這些訊息偏好。

沒有建議的頻率。這是一個在需要時使用的工具,如果您經常直接在資料庫中輸入讀者(例如經由第三方),您可以將它增加到您的排程列中。

DESCRIPTION

如果在資料庫中建立借閱者後啟用了 EnhancedMessagingPreferences 系統偏好,則這些借閱者將沒有為其借閱者類別定義的訊息傳送偏好預設值. 因此,如果您想向每位借閱者發送 '預約已滿' 通知,則必須一一修改.

此腳本為所有讀者建立/覆蓋訊息偏好,並將它們設定為為他們所屬類型定義的預設值(除非您使用選項 -not-expired 或 -no-overwrite 來更新子欄位)。

參數

  • --help

    • 顯示協助訊息.

  • --doit

    • 更新讀者。如果沒有此選項,腳本將不會更新讀者的訊息偏好。它只會列出應更新的讀者。

  • --not-expired

    • 僅更新仍然活躍的讀者(其檔案尚未過期)。

  • --no-overwrite

    • 只更新沒有任何訊息偏好的讀者。此選項將跳過已經設定了偏好的讀者。

  • --category

    • 只更新指定類型的讀者。

    警告

    此選項**不能**重複。

    範例:

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

    只會更新類型 B(指定的最後一個類型)的讀者。

  • --library

    • 只會更新其館藏所屬圖書館與給定分館代碼相符的讀者.

    版本

    Koha 版本 23.11 中新增了 --library 參數.

  • --message-name

    • 只會更新特定訊息的偏好.

    • 值清單可以在 installer/data/mysql/mandatory/sample_notices_message_attributes.sql, 資料庫中的 message_attributes.message_name 或 :ref:`通知和單據工具 <existing-notices-and-slips-label> 中找到.

    版本

    Koha 版本 23.11 中新增了:code:--message-name 參數.

  • --since

    • 僅更新自指定日期以來註冊的讀者。

    备注

    此選項可以使用特定或相對日期。

    範例:

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

    只會更新自 2022 年 7 月 12 日以來註冊的讀者。

    和:

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

    只會更新自昨天以來註冊的讀者。

USAGE EXAMPLES

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

更新所有讀者其各自類型的訊息預設偏好值。

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

更新所有會員資格未過期的讀者其各自類型的訊息預設偏好值。

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

更新 PT 類型中所有讀者的訊息預設偏好。

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

更新未設定任何訊息偏好且自 2022 年 3 月 1 日起註冊的讀者。

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

更新未設定任何訊息傳遞偏好以及自昨天以來註冊的讀者.

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

更新館藏所屬圖書館為 CPL 的讀者.

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

僅更新 "館藏到期" 訊息的偏好.

通知

信件佇列

腳本路徑:misc/cronjobs/process_message_queue.pl

做: 處理訊息序列以向讀者發送外發電子郵件和簡訊. 訊息透過其他腳本在訊息序列中排隊,例如 advance_notices.ploverdue_notices.pl.

备注

要求將 :ref:`EnhancedMessagingPreferences <EnhancedMessagingPreferences-label> 設定為 '允許'.

建議頻率:1-4小時

DESCRIPTION

該腳本處理 message_queue 資料庫表中的消息序列. 它發送該序列中的消息並適當地標記它們以指示成功或失敗. 建議您定期從排程執行此指令,特別是在使用 advance_notices.pl 腳本時.

參數

  • -u | --使用者名稱

    • 用於發送通知的郵件帳戶的使用者名稱.

  • -p | --密碼

    • 用於發送通知的郵件帳號的密碼.

  • -t | --類型

    • 如果提供,則僅處理此類訊息. 可能的值為

      • 電子郵件

      • 簡訊

    • 可重複

  • -c | --代碼

    • 如果提供,則僅處理帶有此 字母代碼 的訊息.

    • 可重複.

  • -l | --限制

    • 本次運行要處理的最大訊息數.

  • -m | --方法

    • SMTP 伺服器所需的驗證方法 (請參閱 perldoc Sendmail.pm 以了解支援的驗證類型).

  • -h | --幫忙

    • 協助留言.

  • -v | --詳細

    • 向 STDOUT 提供詳細輸出.

  • -w | --where

    • 使用 where 子句中的附加條件過濾要傳送的訊息.

提前通知

腳本路徑:misc/cronjobs/advance_notices.pl

做: 為提出請求的讀者準備 "到期提前" 通知與 "到期館藏" 通知 為讀者準備即將到期或即將到期的館藏通知. 需要啟用 EnhancedMessagingPreferences

建議頻率:每晚

說明

此腳本不會真的送出通知。祗把通知置於 訊息佇列 供以後使用

逾期通知

腳本路徑:Script path: misc/cronjobs/overdue_notices.pl

做:準備讀者逾期的訊息 (經電子郵件或列印)

建議頻率:每晚

DESCRIPTION

此腳本根據 :ref:`逾期通知/狀態觸發器工具<overdue-notice/status-triggers-label>`中設定的參數建立逾期通知並將其排序.

參數

  • -n | --nomail

    • 不要發送任何電子郵件. 本應發送給讀者或管理員的逾期通知將以標準輸出列印. CSV 資料 (如果設定了 --csv 標誌) 將寫入標準輸出或任何給定的 CSV 檔案名稱.

  • --max <days>

    • 逾期處理的最長天數.

    • 由於超過最大天數而逾期的館藏被假設在其他地方處理,可能是 longoverdues 腳本. 因此,此腳本將忽略它們. 不會向他們發送任何通知,也不會將它們新增到任何 CSV 檔案中.

    • 預設為 90 天.

  • --library <branchcode>

    • 只處理該圖書館的逾期圖書.

    • 使用 branch.branchcode 表中的值.

    • 此參數是可重複的,用於處理一組圖書館的逾期.

  • --csv <filename>

    • 產生 CSV 檔案.

    • 如果設定了 -n (無郵件) 標誌,則此 CSV 資料將傳送至標準輸出或檔案名稱 (如果提供). 否則,只有無法透過電子郵件傳送的逾期款項才會以 CSV 格式傳送給管理員.

  • --html <directory>

    • 將 html 輸出到給定目錄中的檔案.

    • 如果讀者沒有電子郵件地址或設定 -n (無郵件) 標誌,則會在指定目錄中產生 HTML 檔案. 圖書館館員可以下載或進一步處理該資訊.

    • 該檔案將被命名為 notices-YYYY-MM-DD.html 並放置在指定的目錄中.

  • --text <directory>

    • 將純文字輸出到給定目錄中的檔案.

    • 如果讀者沒有電子郵件地址或設定 -n (無郵件) 標誌,則會在指定目錄中產生一個文字檔案. 圖書館館員可以下載或進一步處理該資訊.

    • 該檔案將命名為 notices-YYYY-MM-DD.txt 並放置在指定的目錄中.

  • --itemscontent <list of fields>

    • 範本中的館藏資訊.

    • 採用逗號分隔的段列表,這些段將會取代到範本中 <<items.content>> 佔位符的位置.

    • 預設為截止日期、標題、條碼、作者

    • 其他可能的值來自書目、館藏和問題表中的段.

  • --borcat <categorycode>

    • 僅為指定的讀者類別準備逾期通知.

    • 此參數是可重複的,以包括多個讀者類別.

    • 使用 categories.categorycode 中的值.

  • --borcatout <categorycode>

    • 不要為指定的讀者類別準備逾期通知.

    • 此參數是可重複的,以排除多個讀者類別.

    • 使用 categories.categorycode 中的值.

    • t | --觸發的

    • 當且僅當專案逾期達到 :ref:`逾期通知觸發器<overdue-notice/status-triggers-label>`中定義的天數時,此選項才會產生通知.

    • 預設情況下,每次腳本執行時都會發送通知,這適用於運行頻率較低的腳本排程,但需要將通知觸發器與排程計劃同步以確保正確的行為.

    • 新增 --每日排程的觸發選項,如果排程無法按時運行,則存在不會產生通知的風險.

  • --測試

    • 此選項使腳本將在測試模式下運行.

    • 在測試模式下,腳本不會對資料庫進行任何變更. 這對於偵錯設定很有用.

  • --列出-全部

    • 預設情況下,<<items.content>> 僅列出那些屬於目前處理通知範圍內的館藏.

    • 選擇 --全部-列出以包含清單中的所有過期館藏 (受限於--最大設定).

  • --日期 <yyyy-mm-dd>

    • 模擬該日期的逾期運行.

  • -電子郵件 <email_type>

    • 指定將使用的電子郵件類型.

    • 可以是 'email', 'emailpro' 或 'B_email'.

    • 此參數是可重複的.

  • --來自分館

    • 透過館藏所屬的圖書館 (item-homebranch) 或借出的圖書館 (item-issuebranch) 組織和發送逾期通知.

    • 預設為 item-issuebranch.

    备注

    僅當 :ref:`OverdueNoticeFrom <OverdueNoticeFrom-label> 系統偏好設定為 '命令列選項' 時,才使用此選項.

USAGE EXAMPLES

"overdue_notices.pl"

(所有圖書館均單獨處理,並為所有擁有逾期圖書且我們有電子郵件地址的讀者準備通知. 對於我們沒有電子郵件地址的讀者,訊息將以單一附件的形式發送至圖書館管理員的電子郵件位址,或寄至:ref:KohaAdminEmailAddress <KohaAdminEmailAddress-label> 系統偏好中的位址.)

"overdue_notices.pl -n --csv /tmp/overdues.csv"

(不發送電子郵件並使用有關所有逾期館藏的資訊填充 /tmp/overdues.csv.)

"overdue_notices.pl --library MAIN max 14

(為主圖書館準備最近兩週的逾期通知.)

备注

該腳本實際上並不發送通知. 它將它們排列在 訊息序列 中以便稍後發送或產生用於列印的 HTML.

备注

也可以看看:

misc/cronjobs/advance_notices.pl 腳本允許您在讀者的館藏到期之前向他們發送訊息,或提醒他們剛剛到期的館藏.

misc/cronjobs/process_message_queue.pl 腳本發送電子郵件.

預約提醒

腳本路徑:misc/cronjobs/holds/holds_reminder.pl

做: 準備發送提醒訊息給等待預約的讀者.

EnhancedMessagingPreferences 必須設定為 '允許',並且讀者必須請求獲得此通知 (透過OPAC 中線上帳戶的 訊息頁籤,如果 EnhancedMessagingPreferencesOPAC 設定為 '顯示',或在館員介面中的 訊息偏好 中).

建議頻率:每晚

參數

  • -c | --確認

    • 確認標誌,不設定該參數則不會產生郵件

  • -日期 <YYYY-MM-DD>

    • 按照在特定日期發送的方式來發送通知

  • -天數 <number of days>

    • 預約已等待的天數

    • 如果未設定此參數,將向所有等待預約的讀者發送通知

    • 可選參數

  • -假期

    • 使用日曆從等待天數中排除假日

  • -lettercode <lettercode>

    • 要使用的 預定義通知 的程式碼

    • 選用參數,預設為 HOLD_REMINDER

  • -圖書館<branchcode>

    • 只處理來自該圖書館的預約

    • 該標誌是可重複的,用於選擇一組圖書館的通知

  • -mtt <message_transport_type>

    • 要傳送的訊息類型 (電子郵件、簡訊、列印)

      • 如果讀者沒有電子郵件地址/電話號碼,'電子郵件' 和 '簡訊' 將退回到 '列印'

    • 預設是使用讀者的 訊息傳遞偏好 作為 '預約提醒' 通知

    • 即使讀者沒有選擇接收預約提醒通知,傳遞此參數也會強制發送

    • 可以重複此操作以發送各種通知

  • -t | --觸發

    • 僅包括等待 <days> 天,而不是更長的時間

    • 如果未設定,腳本將為等待等於或超過 <days> 天的所有預約發送訊息

    • 如果每天執行排程以避免向讀者發送垃圾郵件,則此選項非常有用

    • 可選參數

  • -v

    • 詳細

    • 如果沒有設定此標誌,則只會回報嚴重的錯誤.

    • 如果設定了詳細但未確認,則會將發送給讀者的通知清單以標準輸出方式來列印

  • -幫助

    • 簡短的協助訊息

  • -男人

    • 完整文件

    範例

    下列是此程式的範例:

    ::

    Holds_reminder.pl -library MAIN -第 14 天

    為所屬圖書館準備等待 2 週的預約通知

    ::

    holds_reminder.pl -lettercode LATE_HOLDS -library MAIN -第 14 天

使用 'LATE_HOLDS' 通知範本為所屬圖書館準備等待 2 週的預約通知

Talking Tech

設定此第三方產品的詳情參見 Talking Tech

送出通知檔

腳本路徑:misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl

做:產生 Spec C 的通知檔案供 Talking Tech i-tiva 電話通知系統。

需要: TalkingTechItivaPhoneNotification

建議頻率:每晚

收到通知檔案

腳本路徑:misc/cronjobs/thirdparty/TalkingTech_itiva_inbound.pl

做:腳本處理收到來自Talking Tech i-tiva 電話通知系統的結果檔案。

需要: TalkingTechItivaPhoneNotification

建議頻率:每晚

通知讀者證有效日期

腳本路徑:misc/cronjobs/membership_expiry.pl

做: 向 :ref:`訊息序列 <cron-message-queue-label>`排程發送訊息以警告讀者其卡片已過期. 也可以選擇續借訂閱讀者帳號.

需要: MembershipExpiryDaysNotice

頻率:每天

參數

  • --man

    • 列印手冊頁並退出.

  • --help

    • 列印簡短的協助訊息並退出.

  • -v

    • 詳細.

    • 如果沒有設定此標誌,則只會回報嚴重的錯誤.

  • -n

    • 不要發送任何電子郵件. 發送給讀者的會員到期通知依照標準列印.

  • -c

    • 確認標誌:新增此選項. 否則腳本只會列印一條使用語句.

  • -branch

    • 可選的分館代碼,用於將工作排程限制到該分館.

  • -before

    • 可選參數,用於將選擇範圍延長至系統偏好設定日期之前的天數.

  • -after

    • 可選參數,用於將選擇範圍延長到系統偏好設定日期之後的天數.

    • 例如,--before 100 --after 100 將通知帳戶在 MembershipExpiryDaysNotice 系統偏好之前 100 天和之後 100 天的日期範圍內到期的讀者.

  • -where

    • 使用此選項指定條件. 新增 "me" (別名) ,後面接著借閱者表中的段名稱.

    • Spaces, if necessary, must be escaped by a backslash.

    • Qoutes or double qoutes must be escaped by a backslash.

    • 例如:

      • --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.lastseenISNOTNULL' will only notify patrons who have been seen.

  • -letter

    • 使用預設通知以外的其他通知的可選參數: MEMBERSHIP_EXPIRY

  • -letter_renew

    • 使用預設值以外的其他續借通知的可選參數: MEMBERSHIP_RENEWED

    版本

    Koha 版本 23.11 中新增 :code:`-letter_renew`參數.

  • -active

    • 接下來是好幾個月.

    • 可選參數僅包括活躍的讀者 (在過去的幾個月內活躍).

    • 此參數需要:ref:TrackLastPatronActivityTriggers <tracklastpatronactivitytriggers-label> 系統偏好.

    • 不能與下面的 -inactive 一起使用,兩個參數是互斥的

    版本

    Koha 版本 23.11 中新增 -active 參數.

  • -inactive

    • 接下來是好幾個月.

    • 可選參數,僅包含不活躍的讀者 (自過去幾個月以來不活躍).

    • 此參數需要:ref:TrackLastPatronActivityTriggers <tracklastpatronactivitytriggers-label> 系統偏好.

    • 不能與上面的 :code:`-active`一起使用,兩個參數是互斥的

    版本

    Koha 版本 23.11 中新增e -inactive 參數.

  • -renew

    • 可選參數,用於自動續借的讀者,而不是向他們發送到期通知.

    • 他們將收到會員資格續借通知 (預設 MEMBERSHIP_RENEWED 或由 -letter_renew 指定的自定義通知)

    版本

    Koha 版本 23.11 中新增 -renew 參數.

USAGE EXAMPLES

membership_expiry.pl -c

將為會員資格在 MembershipExpiryDaysNotice 中設定的天數內到期的會員產生 MEMBERSHIP_EXPIRY 通知.

membership_expiry.pl -c -renew

將續借讀者資格在 MembershipExpiryDaysNotice 中設定的天數內到期的讀者,並為他們產生 MEMBERSHIP_RENEWED 通知.

membership_expiry.pl -c -renew -letter_renew PATRON_RENEWAL

將續借讀者資格在 MembershipExpiryDaysNotice 中設定的天數內到期的讀者,並為他們產生自訂的 "PATRON_RENEWAL" 通知. 必須事先在 通知和單據工具 中建立 "PATRON_RENEWAL" 通知.

membership\_expiry.pl -c -before 30

將為讀者資格在 MembershipExpiryDaysNotice 中設定的天數之前 30 天到期的會員產生 MEMBERSHIP_EXPIRY 通知.

membership_expiry.pl -c -renew -active 3

將續借讀者資格在 MembershipExpiryDaysNotice 中設定的天數內到期且在過去三個月內一直處於活動狀態的訂閱會員 ("活動" 由:ref:TrackLastPatronActivityTriggers < tracklastpatronactivitytriggers 確定) -label> 系統偏好),並為它們產生 MEMBERSHIP_RENEWED 通知.

membership_expiry.pl -c -inactive 6 -letter INACTIVE_PATRON

將為讀者產生自訂 "INACTIVE_PATRON" 通知,其會員資格在:ref:MembershipExpiryDaysNotice <MembershipExpiryDaysNotice-label> 中設定的天數內到期,並且在過去六個月內處於非活動狀態 ("活動" 已確定透過 TrackLastPatronActivityTriggers 系統偏好). 必須事先在 通知和單據工具 中建立 "INACTIVE_PATRON" 通知.

處理中/圖書車

腳本路徑:misc/cronjobs/cart_to_shelf.pl

做:以 CART 位置做為館藏永久位置而更新所有館藏。

需要:ref:NewItemsDefaultLocation <NewItemsDefaultLocation-label>, UpdateItemLocationOnCheckinUpdateItemLocationOnCheckout 系統偏好.

建議頻率:每小時

目錄

批次匯入網頁服務

腳本路徑:misc/cronjobs/import_webservice_batch.pl

做:處理批次匯入 '網頁服務' 屬性佇列的工作排程。也可經由 UI 處理批次。

說明

此腳本適用於 OCLC Connexion

批次刪除館藏

腳本路徑:misc/cronjobs/delete_items.pl

做: 產生針對館藏資料庫的查詢並刪除與命令列參數中指定的條件相符的館藏. 輕量級的館藏批次刪除工具,適合在工作排程中執行.

參數

  • --help

    • 列印簡短的協助訊息.

  • --man

    • 列印帶有範例的手冊.

  • --verbose

    • 列印由收集的 --where 參數產生的 "WHERE" 子句,以及影響標準輸出的館藏.

    • 列印的館藏資訊是

      • 館藏編號

      • 條碼

      • 標題

  • --where

    • 以下參數必須是語法上有效的 SQL 語句,它是查詢館藏表的 WHERE 子句的一部分.

    • 可重複. 如果有多個:code:--where 參數,它們將透過 AND 連線.

  • --commit

    • 除非存在此參數,否則不會刪除任何館藏.

USAGE EXAMPLES

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

這將刪除撤回狀態不為零且撤回日期早於 13 個月前的館藏.

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

這將刪除遺失狀態介於 1 和 4 (含) 之間並且在 2014 年 4 月 28 日之前遺失的館藏.

快速檢查 URL

腳本路徑:misc/cronjobs/check-url-quick.pl

备注

此腳本替換了已棄用的 check-url.pl 腳本

做: 檢查書目記錄中的網址;掃瞄所有書目記錄從856段分欄u發現的網址並且顯示

參數

  • --host=http://default.tld 使用不含URL,即不以 'http:' 開頭的伺服器主機。例如,若 --host=http://www.mylib.com,則當856$u包含 'img/image.jpg' 時,檢查的URL為:http://www.mylib.com/image.jpg

  • --tags 段保留分欄u裡的網址。如果未提供,856段已檢查,許多段可以被指定,舉例:

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

  • --verbose|v 兩者輸出成功以及失敗的網址

  • --html 輸出格式為HTML。結果可以轉成檔案,可以透過 http 取得.從這個方式,有可能直接連結至書目記錄的編輯模式。使用此參數 --host-intranet 是必需的.

  • --host-intranet=http://koha-pro.tld 網路伺服器連結至Koha館員介面中書目記錄的編輯頁面。

  • --timeout=10 抓網址的時限。預設10秒。

  • --maxconn=1000 同時請求 HTTP 的數目. 預設是200個連結。

經由紀錄標示刪除紀錄

腳本路徑:misc/cronjobs/delete_records_via_leader.pl

做:刪除紀錄標示第 5 碼的內容為 'd' 的 MARC 紀錄

參數

  • -c|--confirm 若沒有此參數,程式將無法執行

  • -v|--verbose Verbose 模式

  • -t|--test 測試模式,不會刪除記錄。測試模式不能決定記錄/館藏被刪除,它只能讓您知道程式將刪除那些記錄或館藏。

  • -i|--delete-items 在刪除記錄前試著刪除。 記錄連同館藏無法刪除。

更新權威記錄

腳本路徑:misc/cronjobs/merge_authorities.pl

做:依照權威記錄的變動更新對應的書目資料

說明

此腳本的名稱是誤導。此腳本並未合併權威記錄反而合併與其連結的書目記錄。執行腳本時編輯權威記錄將適用於使用權威記錄的書目記錄。

需要: AuthorityMergeLimit 系統偏好

建議頻率:每晚

更新期刊

腳本路徑:misc/cronjobs/serialsUpdate.pl

做:檢查訂閱中的期刊是否有 "遲到" 的刊期,若有,此腳本設定它為遲到,並把下一期列為期待簽收。

建議頻率:每晚

自動更新館藏

腳本路徑:misc/cronjobs/automatic_item_modification_by_age.pl

做: 根據 按年齡自動修改館藏 工具中規定的規則清單更新館藏

要求: 依年齡自動修改館藏

建議頻率:每晚

館藏巡迴

腳本路徑: misc/cronjobs/stockrotation.pl

做: 將館藏從一個 :ref:`館藏巡迴<stock-rotation-label>' 階段移動到下一個階段 ,如果它們可用於處理.

每個圖書館都會收到一份報告,其中包含他們今天輪班檢查的 "感興趣的館藏" . 根據 Koha 的說法,每件館藏都應該位於該分館的書架上,且應該被拿起並托運.

备注

發送的電子郵件是基於 SR_SLIP 範本. 它可以在 通知和單據工具 中進行自訂.

該館藏將:

  • 已被運送到新的待處理圖書館;

  • 已置於運輸途中返回其現階段圖書館;

  • 剛剛被新增到輪調表中並且已在正確的圖書館中;

辦理還入時,

  • 需要轉移到其他地方的館藏將被放入運輸途中,並且會彈出一條訊息,要求將館藏發送到新的分館機構.

  • 已存在於正確圖書館中的館藏將還入,並且不會彈出任何訊息.

需要: :ref:`館藏巡迴<stock-rotation-label>`工具

建議頻率:每晚

參數

  • -a|--admin-email

    • 電子郵件報告也應發送到的地址

    • 這是一個附加電子郵件地址,除了將其發送到分館機構電子郵件地址之外,所有電子郵件報告還將發送到該地址.

  • -b|--分館代碼

    • 選擇要報告 '電子郵件' 報告的分館 (預設值:全部)

    • 如果選擇 '電子郵件' 報告,您可以使用 '分館代碼' 參數來指定您想要查看哪個分館的報告.

    • 預設為 '全部'.

  • -x|--執行

    • 實際執行館藏巡迴管理

    • 預設情況下,此腳本僅報告館藏巡迴子系統的目前狀態. 為了實際放置館藏在運送途中,必須使用 'execute' 參數來執行腳本.

  • -r|--報告

    • 選擇 '完整' 或 '電子郵件'

    • '報告' 參數可讓您選擇將要發出的報告類型.

    • 預設值為 '完整'.

    • 如果選擇 '電子郵件' 報告,您可以使用 '分館代碼' 參數來指定您想要查看哪個分館的報告.

  • -S|--發送全部

    • 即使報告正文為空也發送電子郵件報告

    • 此參數甚至會導致發送正文為空的報告.

  • -s|--發送-電子郵件

    • 透過電子郵件發送報告

    • 此參數使腳本透過電子郵件發送報告.

  • -h|--help

    • 顯示協助訊息

OPAC

RSS Feeds

腳本路徑:misc/cronjobs/rss/rss.pl

做:給任何 SQL 詢問使用的 RSS XML 文件 (不是供搜尋結果 RSS feed 使用)。詳情

建議頻率:每小時

權威瀏覽器

腳本路徑:misc/cronjobs/build_browser_and_cloud.pl

做:在 OPAC 產生權威瀏覽的內容

需要: OpacBrowser 系統偏好

重要

此偏好與工作排程應祗適用於法語系統。

主題/著者雲

腳本路徑:misc/cronjobs/cloud-kw.pl

做:從 Koha Zebra 索引產生 HTML 鍵詞雲。misc/cronjobs/cloud-sample.conf 有若干此腳本運算元的範例。

頻率:這是您可每月執行一次的腳本類型,其內容並不常變動。

系統管理

服務量

腳本路徑:misc/cronjobs/services_throttle.pl

做:重設 xISBN 服務量

建議頻率:每晚

清理資料庫

腳本路徑:misc/cronjobs/cleanup_database.pl

Does: truncates Koha database tables, cleaning out old entries and files. See the Koha database schema for details of each of the tables mentioned in the script parameters.

建議頻率:每晚

參數

  • -h or --help

    • Prints a brief help message and exits, ignoring all other options.

  • -v or --verbose

    • Verbose mode.

  • --confirm

    • Confirm flag: add this option after your other parameters. The script will only

    print a usage statement otherwise.

  • --cards

    • Followed by a number of days.

    • To purge from the creator_batches table any patron card creator batches added before

    the number of days specified.

  • --del-exp-selfreg

    • To delete expired self registration accounts (accounts that haven't been

    upgraded from the 'temporary' category) from the borrowers table.

    • The number of days for expiry is set in the

    PatronSelfRegistrationExpireTemporaryAccountsDelay system preference.

    • The temporary patron category is set in the

    PatronSelfRegistrationDefaultCategory system preference.

  • --del-unv-selfreg

    • Followed by a number of days.

    • To delete all unverified self registrations in borrower_modifications

    older than the number of days specified.

  • --deleted-catalog

    • Followed by a number of days.

    • To purge from tables deletedbiblio, deletedbiblio_metadata, deletedbiblioitems and

    deleteditems any bibliographic records deleted before the number of days specified.

  • --deleted-patrons

    • Followed by a number of days.

    • To purge from the deletedborrowers table any patrons deleted before the number of

    days specified.

  • --edifact-messages

    • Followed by a number of days.

    • To purge from the edifact_messages table any EDIFACT messages older than the number of

    days specified. Messages with the status 'new' are exempt and will not be deleted.

    • Defaults to 365 days if no number specified.

  • --fees

    • Followed by a number of days.

    • To purge entries in the accountlines table older than the number of days specified,

    where the amountoutstanding is 0 or NULL.

    • For this parameter, the number of days specified must be greater than or equal to 1.

  • import

    • Followed by a number of days.

    • To purge from the import_batches, import_biblios, import_items, import_record_matches

    and import_records tables any entries older than the number of days specified.

    • In import_batches, the batches that are the result of Z39.50 searches

    are removed with the --z3950 parameter (see further down).

    • Defaults to 60 days if no number specified.

  • --jobs-days

    • Followed by a number of days.

    • To purge all completed background jobs older than the number of days specified.

    • Defaults to 1 day if no number specified.

  • --jobs-type

    • Followed by a job type.

    • To specify what type(s) of background jobs will be purged according to

    --jobs-days.

    • Using --jobs-type all will purge all types.

    • 此參數是可重複的.

    • Defaults to the update_elastic_index type if omitted.

  • --labels

    • Followed by a number of days.

    • To purge from the creator_batches table any item label batches added before

    the number of days specified.

  • --list-invites

    • Followed by a number of days.

    • To purge (unaccepted) list share invites from the virtualshelfshares table

    older than the number of days specified.

    • Defaults to 14 days if no number specified.

  • --logs

    • Followed by a number of days.

    • To purge entries from the action_logs table older than the number of days specified.

    • Defaults to 180 days if no number specified.

  • --log-module

    for the module names.

  • --preserve-log

    for the module names.

  • -m or --mail

    • Followed by a number of days.

    • To purge entries from the message_queue table that are older than the number of days

    specified.

    • Defaults to 30 days if no number specified.

  • --merged

    • To purge completed entries from the need_merge_authorities table.

  • --messages

    • Followed by a number of days.

    • To purge from the messages table any entries older than the number of days

    specified.

    • Defaults to 365 days if no number specified.

  • --oauth-tokens

    • To delete expired OAuth2 tokens.

  • --old-issues

    • Followed by a number of days.

    • To purge from the old_issues table any checkouts of items returned before the number

    of days specified.

  • --old-reserves

    • Followed by a number of days.

    • To purge from the old_reserves table any holds older than the specified number of days.

  • --pseudo-transactions

    • To purge entries from the pseudonymized_transactions and pseudonymized_borrower_attributes

    tables.

    • This parameter can be used in several ways:

      • with a number of days. E.g., using --pseudo-transactions 750 will remove

      entries older than 750 days.

      • with the --pseudo-transactions-from and / or the --pseudo-transactions-to

      parameter followed by a date in the YYYY-MM-DD format. E.g. using --pseudo-transactions-from 2023-01-01 --pseudo-transactions-to 2023-12-31 will remove entries dated from 1 January 2023 to 31 December 2023.

  • --reports

    • Followed by a number of days.

    • To purge from the saved_reports table any data saved before the number of days specified.

    It concerns the data created by running runreport.pl with the --store-results option.

  • --restrictions

    • Followed by a number of days.

    • To purge from the borrower_debarments table any

    patrons restrictions expired for longer than the specified number of days.

    • 如果未指定天數,則預設為 30 天。

  • --all-restrictions

    • To purge all expired patrons restrictions from the borrower_debarments table.

  • --return-claims

    older than the number of days specified in the system preference CleanUpDatabaseReturnClaims.

  • --searchhistory

    • Followed by a number of days.

    • To purge entries from the search_history table older than the number of days specified.

    • Defaults to 30 days if no number specified.

  • --sessions

    • To purge the sessions table.

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

    login again.

  • --sessdays

    • Followed by a number of days.

    • To purge only sessions older than the specified number of days.

  • --statistics

    • Followed by a number of days.

    • To purge entries from the statistics tables that are older than the specified number of

    days.

    备注

    The statistics table is often used in reports. Make sure you are aware of the consequences before using this parameter.

  • --temp-uploads

    • To delete temporary uploads from the uploaded_files table older than the

    number of days specified in the UploadPurgeTemporaryFilesDays system preference.

  • --temp-uploads-days

    system preference value.

  • --transfers

    • Followed by a number of days.

    • To purge from the branchtransfers table any transfers completed before the number

    of days specified .

  • --unique-holidays

    • Followed by a number of days.

    • To delete from the special_holidays table any unique holidays older than the number of

    days specified.

  • --uploads-missing

    • Followed by a flag.

    • To delete upload records for missing files when the specified flag is true;

    and count them otherwise.

  • --zebraqueue

    • Followed by a number of days.

    • To purge completed zebraqueue entries older than the number of days specified.

    • Defaults to 30 days if no number specified.

  • --z3950

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

    • If you are looking to purge all other import information, see the --import

    parameter above.

使用範例

cleanup_database.pl --sessdays 7 --zebraqueue --list-invites --temp-uploads --mail 375
--import 375 --logs 200 --searchhistory 60 --del-exp-selfreg --statistics 731
--pseudo-transactions 1827 --deleted-patrons 1 --restrictions 90 --unique-holidays 180 --confirm

This script will:

  • delete OPAC sessions for users who last accessed the site over 7 days ago;

  • keep the record of zebra reindexes to 30 days;

  • expire invitations to view a list shared over 14 days ago;

  • clear the temporary uploads according to the UploadPurgeTemporaryFilesDays

system preference;

  • remove the record of notices sent to patrons when those notices were sent over 375 days ago;

  • delete files uploaded for batch import after 375 days (though the bibliographic and item records imported as part of the process will remain);

  • clear the logs from any actions performed over 200 days ago;

  • remove both patron and staff search history older than 60 days;

  • delete patron self-registration requests according to the PatronSelfRegistrationExpireTemporaryAccountsDelay system preference.

  • delete transactions stored in the statistics table when they are over 731 days old;

  • clear the pseudonymized transactions data that's older than 5 years;

  • fully delete patrons the day following their manual deletion in the Koha staff interface;

  • clear the record of patrons' expired restrictions when that restriction has been lifted for over 90 days;

  • remove closed days older than 180 days from the calendar.

共享使用統計

路徑腳本:misc/cronjobs/share_usage_with_koha_community.pl

做: 如果您透過 UsageStats 功能共享訊息,則將您的訊息傳送到 Hea website

頻率:每月

搜尋資料不一致的情況

腳本路徑: misc/maintenance/search_for_data_inconsistcies.pl

做: 揭示數據中的問題,例如

  • 沒有所屬圖書館或預約館藏:ref:圖書館 <libraries-label>

  • 沒有 館藏類型 或無效 館藏類型 的館藏

  • 沒有 館藏類型 或無效 館藏類型 的書目記錄

  • 具有無效 MARCXML 的書目記錄

  • MARCXML 中沒有書目號碼或書目館藏號碼的書目記錄

  • 無標題的書目記錄

  • 框架 限制 容許值類別 的段中的值無效

  • 沒有 權限類型 或無效 權限類型 的權限記錄

  • 對於他們的 類別 來說太老或太年輕的讀者

其中一些問題可能會導致流通或目錄搜尋出現問題,因此糾正這些問題非常重要.

沒有建議的頻率. 這是需要時使用的工具.

採訪

清除舊的建議

腳本路徑:misc/cronjobs/purge_suggestions.pl

做:從建議管理區域移除舊的建議。

參數

  • 幫助|?

    顯示協助資訊

  • 根據“管理於”日期定義要刪除的建議時期

    备注

    系統偏好 PurgeSuggestionsOlderThan 也可用於定義腳本中使用的天數. 若使用系統偏好,請勿使用 '天' 參數.

    备注

    基於 '管理於' 建議的天數。

  • 確認

    此參數對於腳本執行是必需的。

將建議以電郵送入程序

腳本路徑:misc/cronjobs/notice_unprocessed_suggestions.pl

做:將待處理的採訪建議告知基金擁有者

EDI 訊息處理

腳本路徑:misc/cronjobs/edi_cron.pl

做:送出與接收 EDI 訊息

頻率:每 15 分鐘

移除暫存 EDI 檔案

腳本路徑:misc/cronjobs/remove_temporary_edifiles.pl

做:移除 5 天前的暫存 EDI 檔案

電子資源管理 (ERM)

收穫工作排程

腳本路徑: /misc/cronjobs/erm_run_harvester.pl

做: 此腳本將為 電子資源管理模組 中設定的任何活動使用資料提供者執行 SUSHI 收集.

頻率:建議您將其設定為定期運行 (例如,每月運行,因為提供者通常每月產生統計資料).

參數

  • --help or -h

    • 列印協助訊息

  • --begin-date

    • 以 yyyy-mm-dd 格式設定收穫的開始日期 (例如: '2023-08-21')

  • --end-date

    • 以 yyyy-mm-dd 格式設定收穫結束日期 (例如: '2023-08-21')

  • --dry-run

    • 產生運行報告,但實際上不做任何永久性的事情

  • --debug

    • 在運行期間列印附加偵錯訊息

使用範例

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

將針對 2023 年 6 月 21 日至今 (或資料可用之日) 期間的活躍使用資料提供者進行 SUSHI 收集. 將顯示有關收穫運行方式的其他偵錯資訊.

報告

執行報表

腳本路徑: misc/cronjobs/runreport.pl

做: 執行預先存在的 已儲存的報告,可以選擇透過電子郵件發送結果.

參數

  • -h | --help

    • 顯示協助訊息

  • -m | --man

    • 顯示完整文件

    • 與 :code:`--help --verbose`相同

  • -v | --verbose

    • 詳細輸出

    • 如果沒有該參數,只回報嚴重的錯誤

  • --format=s

    • 選擇匯出格式

    • 可能的值:

      • 文字

      • html

      • csv

      • tsv

    • 目前,'text' 和 'tsv' 都產生頁籤分隔的輸出

    • 預設為 '文字'

  • -e | --email

    • 透過電子郵件發送輸出 (透過 --to--from 暗示)

  • --send_empty

    • 即使報告沒有回傳結果,也發送電子郵件

    版本

    Koha 版本 23.11 中新增:code:--send_empty 參數.

  • -a | --attachment

    • 將報告作為檔案附加

    • 不能用於 html 格式

  • --username

    • 傳遞到 SMTP 伺服器進行身份驗證的使用者名稱

  • --password

    • 傳遞到 SMTP 伺服器進行身份驗證的密碼

  • --method

    • 驗證類型,即 LOGIN、DIGEST-MD5 等.

  • --to=s

    • 用於傳送報告結果的電子郵件地址

    • 如果指定 --email ,但未指定 --to ,則使用 KohaAdminEmailAddress 中的位址

  • --from=s

    • 發送報告的電子郵件地址

    • 如果指定 --email ,但未指定 --from ,則使用 KohaAdminEmailAddress 中的位址

  • --subject=s

    • 電子郵件的主題

  • --param=s

    • 傳遞 :ref:`運行時參數 <report-writing-tips-runtime-parameters-label>`的值

    • 可重複

    • 為報表請求的每個執行時間參數提供一個 --param. 報表參數不會像館員端那樣組合,因此您可能需要重複參數.

  • --separator=s

    • 分隔符

    • 僅適用於csv格式

    • 預設為逗號

  • --quote=s

    • 引用字符

    • 僅適用於csv格式

    • 預設為雙引號

    • 允許空字串

    版本

    Koha 版本 23.11 中新增 --quote 參數.

  • --store-results

  • --csv-header

    • 新增列名稱作為 csv 輸出的第一行

參數

  • reportID

    • 來自 saved_sql.id 的報表ID號碼

    • 可以指定多個ID

    • 強制的

USAGE EXAMPLES

runreport.pl 1

將在終端機 (STDOUT) 中輸出報告 1 的結果.

runreport.pl 1 5

將在終端機 (STDOUT) 中輸出報告 1 和 5 的結果.

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

將以 HTML 格式將報告 1 的結果傳送至 admin@myDNSname.org.

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

將以 HTML 格式將報告 1 的結果傳送至 admin@myDNSname.org. 'CPL' 將傳遞給第一個運行時參數,'FICTION' 將傳遞給第二個運行時參數.

runreport.pl --store-results 1

將報表結果儲存在saved_reports 資料庫表中,並且可以從館員介面中使用 報表 > 指導報表 > 已儲存報表.

社會資料

取得社會資料報表

腳本路徑:misc/cronjobs/social_data/get_report_social_data.pl

做:從 Babelthèque 下載資料加入 OPAC 紀錄

建議頻率:每晚

更新社會資料

腳本路徑:misc/cronjobs/social_data/update_social_data.pl

做:以 Babelthèque 資料更新 OPAC 紀錄

守護行程

Daemons are continuously running tasks that help support Koha operation. Your database and web-server are run as daemons.

Automatically started daemons

Newer versions of Koha start two different daemons for most koha instances:

  • zebra - 此為索引伺服器

  • koha-indexer - 此守護行程使用新的和修改的數據(書目和權威)更新索引伺服器

這些守護行程由腳本 /etc/init.d/koha-common 啟動。

Zebra indexer daemon

腳本路徑:/usr/sbin/koha-indexer(從 /etc/init.d/koha-common 調用)

koha-indexer 腳本以守護行程模式調用 rebuild_zebra.pl。此模式下,腳本將連續運作並每30秒檢查數據庫中是否有新數據或修改過的數據。 然後將新記錄或修改後的記錄發送到Zebra 進行索引,這只需一秒鐘左右。與 cron job approach 相比,此方法的優點是搜尋系統對更改的反應快很多。

Other daemons

These are not started automatically by Koha. You could run them manually, or create your own systemd unit to keep them running.

OCLC Connexion import daemon

Script path: misc/bin/connexion_import_daemon.pl

Does: Listens for requests from OCLC Connexion clients and is compliant with the OCLC Gateway specification.

See Setting up the OCLC Connexion Daemon for more details.

不適用的腳本

不應在未修改前執行這些:

腳本路徑:misc/cronjobs/update_items.pl

腳本路徑:misc/cronjobs/smsoverdues.pl

腳本路徑:misc/cronjobs/notifyMailsOp.pl

腳本路徑:misc/cronjobs/reservefix.pl

腳本路徑:misc/cronjobs/zebraqueue_start.pl