タグ: SKK

  • yaskkserv2 を systemd に登録

    最近はRustで実装されたSKKサーバがあるようだ。

    https://github.com/wachikun/yaskkserv2

    インストールはREADMEの通りで問題ない。

    最新の辞書を定期的に取得し、サーバが扱える形式に変換。

    uep@curt:/etc/systemd/system$ sudo crontab -l
    # m h  dom mon dow   command
    0 6 * * * cd /usr/local/src/dict && git pull
    # git clone https://github.com/skk-dev/dict.git
    0 7 * * * cd /usr/local/src/dict && /usr/local/bin/yaskkserv2_make_dictionary --dictionary-filename=/usr/local/share/dictionary.yaskkserv2 SKK-JISYO.L SKK-JISYO.jinmei SKK-JISYO.fullname SKK-JISYO.geo SKK-JISYO.propernoun SKK-JISYO.station zipcode/SKK-JISYO.zipcode zipcode/SKK-JISYO.office.zipcode

    自動起動するよう systemd に登録

    uep@curt:/etc/systemd/system$ cat /etc/systemd/system/yaskkserv2.service
    [Unit]
    Description=Yet Another SKK server
    
    [Service]
    User=nobody
    ExecStart=yaskkserv2 --config-filename /usr/local/etc/yaskkserv2.conf --no-daemonize
    
    [Install]
    WantedBy=multi-user.target
    
    uep@roland:/etc/systemd/system$ cat yaskkserv2-dict-update.service
    [Unit]
    Description=Update yaskkserv2 dictionary
    Wants=network-online.target
    After=network-online.target
    
    [Service]
    Type=oneshot
    ExecStart=/usr/local/sbin/yaskkserv2-update-dict.sh
    
    uep@roland:/etc/systemd/system$ cat yaskkserv2-dict-update.timer
    [Unit]
    Description=Weekly yaskkserv2 dictionary update
    
    [Timer]
    OnCalendar=Sun *-*-* 04:00:00
    RandomizedDelaySec=30min
    Persistent=true
    
    [Install]
    WantedBy=timers.target

    サーバ設定ファイルを作成しておく

    uep@curt:/etc/systemd/system$ cat /usr/local/etc/yaskkserv2.conf
    # default none
    dictionary = /usr/local/share/dictionary.yaskkserv2
    # default 1178
    port = 1178
    # default 16
    max-connections = 16
    # default 0.0.0.0
    listen-address = 0.0.0.0
    # default localhost:127.0.0.1
    hostname-and-ip-address-for-protocol-3 = localhost:127.0.0.1
    # default 64
    max-server-completions = 64
    # default 1000
    google-timeout-milliseconds = 1000
    # default disable
    # google-cache-filename = [FILENAME]
    # default 1024
    google-cache-entries = 1024
    # default 2592000
    google-cache-expire-seconds = 2592000
    # default 25
    google-max-candidates-length = 25
    # default notfound (disable / last / fast)
    google-japanese-input = notfound
    # default disable
    google-suggest = enable
    # default disable
    google-use-http = disable
    # default disable
    google-insert-hiragana-only-candidate = disable
    # default disable
    google-insert-katakana-only-candidate = disable
    # default disable
    google-insert-hankaku-katakana-only-candidate = disable

    有効化と動作確認

    sudo systemctl daemon-reload
    sudo systemctl enable --now yaskkserv2.service
    sudo systemctl start yaskkserv2.service
    sudo systemctl enable --now yaskkserv2-dict-update.timer
    sudo systemctl start yaskkserv2-dict-update.service
    systemctl list-timers yaskkserv2-dict-update.timer
    journalctl -u yaskkserv2-dict-update.service -n 50