Man page - systemd-notify(1)
Packages contains this manual
- systemd-initctl.service(8)
- systemd-networkd.service(8)
- org.freedesktop.locale1(5)
- timedatectl(1)
- systemd.resource-control(5)
- systemd.journal-fields(7)
- systemd-logind.service(8)
- busctl(1)
- systemd-pstore(8)
- systemd.generator(7)
- hostname(5)
- systemd-path(1)
- systemd-random-seed.service(8)
- locale.conf(5)
- systemd-firstboot(1)
- systemd-sysv-generator(8)
- systemd.syntax(7)
- loginctl(1)
- tmpfiles.d(5)
- org.freedesktop.portable1(5)
- systemd-timedated(8)
- systemd-pstore.service(8)
- systemd-escape(1)
- systemd-system-update-generator(8)
- systemd-backlight@.service(8)
- systemd-udev-settle.service(8)
- systemd.directives(7)
- systemd.index(7)
- systemd.environment-generator(7)
- systemd-network-generator.service(8)
- org.freedesktop.systemd1(5)
- systemd-user-sessions.service(8)
- systemd-pcrlock(8)
- systemd-journald.socket(8)
- systemd-user-runtime-dir(5)
- systemd-logind(8)
- systemd-initctl.socket(8)
- systemd-pcrlock-make-policy.service(8)
- systemd(1)
- systemd-inhibit(1)
- networkctl(1)
- systemd-random-seed(8)
- sysusers.d(5)
- systemd-boot-check-no-failures(8)
- systemd.v(7)
- systemd-creds(1)
- systemd-networkd(8)
- systemd-makefs(8)
- systemd-fsck(8)
- systemd-localed.service(8)
- journald.conf.d(5)
- systemd-pcrfs@.service(8)
- systemd-cat(1)
- systemd-id128(1)
- user@.service(5)
- systemd.unit(5)
- systemd.net-naming-scheme(7)
- systemd-volatile-root(8)
- org.freedesktop.machine1(5)
- systemd-firstboot.service(1)
- localtime(5)
- systemd-timedated.service(8)
- systemd-ask-password-console.path(8)
- varlinkctl(1)
- org.freedesktop.timedate1(5)
- systemd-run-generator(8)
- systemd-system.conf(5)
- systemd-journald-varlink@.socket(8)
- systemd-rfkill.socket(8)
- systemd.exec(5)
- systemd-journald@.socket(8)
- systemd-shutdown(8)
- systemd-fsck-usr.service(8)
- systemd-sysctl.service(8)
- systemd-pcrphase.service(8)
- systemd-localed(8)
- systemd-journald(8)
- systemd-ssh-proxy(1)
- systemd.offline-updates(7)
- systemd-pcrlock-secureboot-authority.service(8)
- systemd-ac-power(1)
- pam_systemd_loadkey(8)
- systemd.device(5)
- systemd-quotacheck.service(8)
- systemd-machine-id-commit.service(8)
- systemd-backlight(8)
- binfmt.d(5)
- systemd-getty-generator(8)
- networkd.conf.d(5)
- systemd.path(5)
- systemd-networkd-wait-online.service(8)
- system.conf.d(5)
- systemd-detect-virt(1)
- systemd-sleep.conf(5)
- sysctl.d(5)
- systemd-vpick(1)
- systemd-pcrlock-secureboot-policy.service(8)
- systemd-update-done(8)
- systemd-sysctl(8)
- pstore.conf.d(5)
- hostnamectl(1)
- systemd-confext(8)
- logind.conf.d(5)
- capsule@.service(5)
- systemd-poweroff.service(8)
- systemd-modules-load(8)
- systemd.special(7)
- org.freedesktop.network1(5)
- systemd.pcrlock.d(5)
- systemd-kexec.service(8)
- systemd-stdio-bridge(1)
- systemd-umount(1)
- systemd-quotacheck(8)
- systemd-sysext.service(8)
- systemd-notify(1)
- systemd-suspend-then-hibernate.service(8)
- systemd-growfs(8)
- systemctl(1)
- systemd-hibernate-clear.service(8)
- systemd-run(1)
- systemd-pcrlock-firmware-code.service(8)
- systemd-sysusers.service(8)
- environment.d(5)
- systemd-networkd-wait-online(8)
- systemd-initctl(8)
- systemd-remount-fs.service(8)
- systemd.network(5)
- systemd-journald@.service(8)
- systemd-pcrlock-file-system.service(8)
- systemd-hibernate-resume.service(8)
- systemd-tty-ask-password-agent(1)
- systemd-growfs@.service(8)
- systemd-ask-password(1)
- systemd-hibernate-resume-generator(8)
- systemd-sleep(8)
- systemd.image-policy(7)
- systemd-hibernate.service(8)
- systemd.timer(5)
- systemd-boot-check-no-failures.service(8)
- networkd.conf(5)
- systemd-tpm2-setup(8)
- systemd-pcrphase-initrd.service(8)
- systemd-xdg-autostart-generator(8)
- systemd-tmpfiles-setup-dev-early.service(8)
- systemd-binfmt(8)
- systemd-user-sessions(8)
- file-hierarchy(7)
- systemd-socket-proxyd(8)
- localectl(1)
- modules-load.d(5)
- machine-id(5)
- systemd-battery-check.service(8)
- systemd-update-done.service(8)
- systemd.mount(5)
- systemd-machine-id-setup(1)
- systemd-storagetm.service(8)
- systemd-growfs-root.service(8)
- systemd.swap(5)
- systemd-hibernate-resume(8)
- initrd-release(5)
- systemd.target(5)
- sleep.conf.d(5)
- systemd-mkswap@.service(8)
- journald@.conf(5)
- systemd-reboot.service(8)
- systemd-journald.service(8)
- systemd-socket-activate(1)
- systemd-tmpfiles-clean.timer(8)
- systemd-debug-generator(8)
- systemd-cgtop(1)
- systemd-measure(1)
- systemd.service(5)
- systemd.slice(5)
- systemd-remount-fs(8)
- systemd-ssh-generator(8)
- systemd-bsod(8)
- systemd-pcrlock-firmware-config.service(8)
- systemd-bsod.service(8)
- systemd-pcrmachine.service(8)
- logind.conf(5)
- bootup(7)
- kernel-install(8)
- systemd-networkd-wait-online@.service(8)
- systemd-network-generator(8)
- kernel-command-line(7)
- pstore.conf(5)
- rc-local.service(8)
- systemd-confext.service(8)
- systemd-soft-reboot.service(8)
- systemd.system-credentials(7)
- systemd-fstab-generator(8)
- systemd-tpm2-setup-early.service(8)
- systemd-tmpfiles(8)
- systemd.preset(5)
- run0(1)
- user.conf.d(5)
- systemd-pcrlock-machine-id.service(8)
- os-release(5)
- systemd-fsck-root.service(8)
- systemd-battery-check(8)
- systemd.automount(5)
- systemd-pcrfs-root.service(8)
- systemd.kill(5)
- systemd-pcrphase-sysinit.service(8)
- journalctl(1)
- 30-systemd-environment-d-generator(8)
- systemd.socket(5)
- systemd-rc-local-generator(8)
- systemd-sysext(8)
- systemd-fsck@.service(8)
- systemd.time(7)
- systemd-rfkill(8)
- systemd-ask-password-wall.path(8)
- machine-info(5)
- systemd-tpm2-generator(8)
- systemd-binfmt.service(8)
- org.freedesktop.login1(5)
- systemd-delta(1)
- systemd-tmpfiles-clean.service(8)
- systemd-ask-password-wall.service(8)
- user-runtime-dir@.service(5)
- systemd-cgls(1)
- smbios-type-11(7)
- systemd-ask-password-console.service(8)
- systemd.netdev(5)
- systemd-journald-dev-log.socket(8)
- systemd-storagetm(8)
- systemd-journald-audit.socket(8)
- systemd-tmpfiles-setup-dev.service(8)
- systemd-hybrid-sleep.service(8)
- systemd-analyze(1)
- systemd-environment-d-generator(8)
- systemd-hostnamed(8)
- systemd-hostnamed.service(8)
- systemd-pcrextend(8)
- systemd-tmpfiles-setup.service(8)
- systemd.pcrlock(5)
- systemd-tpm2-setup.service(8)
- systemd-suspend.service(8)
- systemd-mount(1)
- org.freedesktop.hostname1(5)
- extension-release(5)
- systemd-makefs@.service(8)
- iocost.conf(5)
- systemd-gpt-auto-generator(8)
- systemd-halt.service(8)
- systemd-modules-load.service(8)
- systemd-sysusers(8)
- systemd-user.conf(5)
- systemd-rfkill.service(8)
- systemd-volatile-root.service(8)
- systemd.scope(5)
- daemon(7)
- journald.conf(5)
apt-get install systemd
Available languages:
en zh_TW zh_CN deManual
SYSTEMD-NOTIFY
NAMESYNOPSIS
描 述
選 項
退 出 狀 態
例 子
參 見
跋
NAME
systemd-notify - 向 systemd 報 告 服 務 狀 態 的 變 化
SYNOPSIS
|
systemd-notify [OPTIONS...] [VARIABLE=VALUE...] |
描 述
systemd-notify 可 用 於 在 守 護 程 序 指 令 碼 中 向 systemd 報 告 程 序 狀 態 的 變 化 。 可 用 於 傳 送 任 意 資 訊 , 其 中 最 重 要 的 是 報 告 "啟 動 已 完 成 "的 訊 息 。
此 工 具 基 本 上 就 是 對 sd_notify() 的 簡 單 包 裝 , 以 便 於 在 指 令 碼 中 使 用 。 詳 見 sd_notify (3) 手 冊 。
注 意 , 在 報 告 狀 態 更 新 的 同 時 , 還 可 以 傳 遞 一 系 列 環 境 變 數 。
注 意 , 除 非 在 呼 叫 此 命 令 的 服 務 單 元 中 設 定 了 NotifyAccess=all , 否 則 systemd 將 會 拒 絕 接 受 狀 態 更 新 的 訊 息 。
選 項
能 夠 識 別 的 命 令 列 選 項 如 下 :
--ready
向 systemd 報 告 "啟 動 已 完 成 "的 訊 息 。 這 等 價 於 systemd-notify READY=1 。 詳 見 sd_notify (3) 手 冊 。
--pid=
向 systemd 報 告 主 守 護 程 序 的 PID 。 如 果 PID 引 數 被 省 略 , 將 使 用 呼 叫 systemd-notify 的 程 序 的 PID 。 這 等 價 於 systemd-notify MAINPID=$PID 。 詳 見 sd_notify (3) 手 冊 。
--status=
向 systemd 傳 送 一 個 任 意 內 容 的 字 串 訊 息 。 這 等 價 於 systemd-notify STATUS=... 。 詳 見 sd_notify (3) 手 冊 。
--booted
用 於 檢 查 系 統 的 init 程 序 是 否 為 systemd , 返 回 0 表 示 系 統 的 init 程 序 是 systemd , 返 回 非 零 表 示 其 他 。 此 選 項 並 不 傳 送 任 何 訊 息 , 因 此 與 其 他 選 項 沒 有 任 何 關 係 。 詳 見 sd_booted (3) 手 冊 。 另 一 種 檢 查 方 法 是 systemctl (1) 的 is-system-running 命 令 。 若 返 回 "offline" 則 表 示 系 統 的 init 程 序 不 是 systemd
-h , --help
顯 示 簡 短 的 幫 助 資 訊 並 退 出 。
--version
顯 示 簡 短 的 版 本 資 訊 並 退 出 。
退 出 狀 態
返 回 值 為 0 表 示 成 功 , 非 零 返 回 值 表 示 失 敗 程 式 碼 。
例 子
Example 1. 啟 動 通 知 與 狀 態 更 新
一 個 簡 單 的 守 護 程 序 指 令 碼 , 在 建 立 好 通 訊 管 道 之 後 , 向 systemd 報 告 "啟 動 已 完 成 "的 訊 息 。 在 執 行 時 , 向 systemd 報 告 更 多 的 狀 態 訊 息 :
#!/bin/bash
mkfifo
/tmp/waldo
systemd-notify --ready --status="Waiting for
data..."
while : ; do
read a < /tmp/waldo
systemd-notify --status="Processing $a"
# Do something with $a ...
systemd-notify
--status="Waiting for data..."
done
參 見
systemd (1), systemctl (1), systemd.unit (5), sd_notify (3), sd_booted (3)
跋
本 頁 面 中 文 版 由 中 文 man 手 冊 頁 計 劃 提 供 。
翻
譯 人 員 : 金 步
國
金 步 國 作 品 集
: http://www.jinbuguo.com
中 文 man 手 冊 頁 計
劃 :
https://github.com/man-pages-zh/manpages-zh