Systemd `journalctl` - デフォルト $PAGER を変更できません。

Systemd `journalctl` - デフォルト $PAGER を変更できません。

私はアーチLinuxを使用しています。

新しいポケットベルソフトウェアを発見しましたOVそしてそれをインストールしました。より多くの機能があり、less気に入ってデフォルトのポケットベルに設定したいと思います。

私の.bashrcに以下を追加しました。

export PAGER=/usr/bin/ov

ほとんどのプログラムはこの環境変数(例えばman)を尊重しますが、何らかの理由でjournalctlそうではありません。この問題をインターネット検索中に他の変数が見つかりましたSYSTEMD_PAGER。この環境変数を設定すると問題が解決すると予想されていましたが、そうではありませんでした。

でも:

export PAGER=/usr/bin/ov
export SYSTEMD_PAGER=/usr/bin/ov

それは無駄です。それからvarを明示的に渡そうとします。

PAGER=/usr/bin/ov journalctl
SYSTEMD_PAGER=/usr/bin/ov journalctl

不運。journalctl いつもデフォルトのポケットlessベルを使用します。

私はそれを強制する方法を見つけました。

journalctl | ov

これはうまくいきますが、毎回パイプしたくありません。環境変数を尊重する必要があります。

journalctl文書を見ましたが、答えが見つかりませんでした。

systemd用のデフォルトポケットベルを設定できますかjournalctl?それでは、どうすればいいですか?

ベストアンサー1

SYSTEMD_PAGERSECURE私は実際にそれを見たと思います。 ~からman journalctl:

$SYSTEMD_PAGER
   Pager to use when --no-pager is not given; overrides $PAGER.
   If neither $SYSTEMD_PAGER nor $PAGER are set, a set of
   well-known pager implementations are tried in turn, including
   less(1) and more(1), until one is found. If no pager
   implementation is discovered no pager is invoked. Setting
   this environment variable to an empty string or the value
   "cat" is equivalent to passing --no-pager.

   Note: if $SYSTEMD_PAGERSECURE is not set, $SYSTEMD_PAGER (as
   well as $PAGER) will be silently ignored.

そして:

$SYSTEMD_PAGERSECURE
   Takes a boolean argument. When true, the "secure" mode of the
   pager is enabled; if false, disabled. If $SYSTEMD_PAGERSECURE
   is not set at all, secure mode is enabled if the effective
   UID is not the same as the owner of the login session, see
   geteuid(2) and sd_pid_get_owner_uid(3). In secure mode,
   LESSSECURE=1 will be set when invoking the pager, and the
   pager shall disable commands that open or create new files or
   start new subprocesses. When $SYSTEMD_PAGERSECURE is not set
   at all, pagers which are not known to implement secure mode
   will not be used. (Currently only less(1) implements secure
   mode.)

だからこれはうまくいきます:

SYSTEMD_PAGERSECURE=true PAGER=/usr/bin/ov journalctl

おすすめ記事