1SYSTEMD-NOTIFY(1) systemd-notify SYSTEMD-NOTIFY(1)
2
3
4
6 systemd-notify - Notify service manager about start-up completion and
7 other daemon status changes
8
10 systemd-notify [OPTIONS...] [VARIABLE=VALUE...]
11
13 systemd-notify may be called by daemon scripts to notify the init
14 system about status changes. It can be used to send arbitrary
15 information, encoded in an environment-block-like list of strings. Most
16 importantly it can be used for start-up completion notification.
17
18 This is mostly just a wrapper around sd_notify() and makes this
19 functionality available to shell scripts. For details see sd_notify(3).
20
21 The command line may carry a list of environment variables to send as
22 part of the status update.
23
24 Note that systemd will refuse reception of status updates from this
25 command unless NotifyAccess=all is set for the service unit this
26 command is called from.
27
29 The following options are understood:
30
31 --ready
32 Inform the init system about service start-up completion. This is
33 equivalent to systemd-notify READY=1. For details about the
34 semantics of this option see sd_notify(3).
35
36 --pid=
37 Inform the init system about the main PID of the daemon. Takes a
38 PID as argument. If the argument is omitted, the PID of the process
39 that invoked systemd-notify is used. This is equivalent to
40 systemd-notify MAINPID=$PID. For details about the semantics of
41 this option see sd_notify(3).
42
43 --status=
44 Send a free-form status string for the daemon to the init systemd.
45 This option takes the status string as argument. This is equivalent
46 to systemd-notify STATUS=.... For details about the semantics of
47 this option see sd_notify(3).
48
49 --booted
50 Returns 0 if the system was booted up with systemd, non-zero
51 otherwise. If this option is passed, no message is sent. This
52 option is hence unrelated to the other options. For details about
53 the semantics of this option, see sd_booted(3).
54
55 --readahead=
56 Controls disk read-ahead operations. The argument must be a string,
57 and either "cancel", "done" or "noreplay". For details about the
58 semantics of this option see sd_readahead(3).
59
60 -h, --help
61 Print a short help text and exit.
62
63 --version
64 Print a short version string and exit.
65
67 On success, 0 is returned, a non-zero failure code otherwise.
68
70 Example 1. Start-up Notification and Status Updates
71
72 A simple shell daemon that sends start-up notifications after having
73 set up its communication channel. During runtime it sends further
74 status updates to the init system:
75
76 #!/bin/bash
77
78 mkfifo /tmp/waldo
79 systemd-notify --ready --status="Waiting for data..."
80
81 while : ; do
82 read a < /tmp/waldo
83 systemd-notify --status="Processing $a"
84
85 # Do something with $a ...
86
87 systemd-notify --status="Waiting for data..."
88 done
89
91 systemd(1), systemctl(1), systemd.unit(5), sd_notify(3), sd_booted(3)
92
93
94
95systemd 219 SYSTEMD-NOTIFY(1)