2 .\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH SYSEVENTADM 8 "Sep 28, 2005"
8 syseventadm \- sysevent event specification administration
12 \fBsyseventadm\fR add [\fB-R\fR \fIrootdir\fR] [\fB-v\fR \fIvendor\fR] [\fB-p\fR \fIpublisher\fR]
13 [\fB-c\fR \fIclass\fR] [\fB-s\fR \fIsubclass\fR] [\fB-u\fR \fIusername\fR] \fIpath\fR [\fIargs\fR]
18 \fBsyseventadm\fR remove [\fB-R\fR \fIrootdir\fR] [\fB-v\fR \fIvendor\fR] [\fB-p\fR \fIpublisher\fR]
19 [\fB-c\fR \fIclass\fR] [\fB-s\fR \fIsubclass\fR] [\fB-u\fR \fIusername\fR] [\fIpath\fR [\fIargs\fR]]
24 \fBsyseventadm\fR list [\fB-R\fR \fIrootdir\fR] [\fB-v\fR \fIvendor\fR] [\fB-p\fR \fIpublisher\fR]
25 [\fB-c\fR \fIclass\fR] [\fB-s\fR \fIsubclass\fR] [\fB-u\fR \fIusername\fR] [\fIpath\fR [\fIargs\fR]]
30 \fBsyseventadm\fR restart
36 The \fBsyseventadm\fR command is an administrative front-end to add, remove and
37 list \fBsysevent\fR event handlers. You can also restart the sysevent daemon by
38 use of the restart command. \fBsyseventadm\fR can only be run by root.
41 The \fBsyseventadm\fR \fBadd\fR command adds a handler for a \fBsysevent\fR
42 event specified by at least one of vendor, publisher or class. If \fIclass\fR
43 is specified, it may be qualified with a \fIsub-class\fR. Only the values
44 specified for \fIvendor\fR, \fIpublisher\fR, \fIclass\fR and \fIsub-class\fR
45 when adding the handler are matched against \fBsysevent\fR events to determine
46 if the specification matches the event and the handler should be run.
47 \fIpath\fR is the full pathname of the command to be run in response to
48 matching events, with optional arguments (\fIargs\fR). If username is
49 specified, the command is invoked as user \fIusername\fR, otherwise as root.
52 The \fBsyseventadm\fR \fBremove\fR command removes handlers for matching
53 sysevent event specifications. Event specifications may be matched by
54 specifying at least one of \fIvendor\fR, \fIpublisher\fR, \fIclass\fR,
55 \fIusername\fR or \fIpath\fR. If \fIclass\fR is specified, it may be qualified
56 with a \fIsub-class\fR. Any of \fIvendor\fR, \fIpublisher\fR, \fIclass\fR,
57 \fIsub-class\fR, \fIusername\fR, \fIpath\fR or \fIargs\fR not specified match
58 the corresponding fields of all events. Handlers for all matching
59 specifications are removed.
62 The \fBsyseventadm\fR \fBlist\fR command lists the handlers for matching
63 \fBsysevent\fR event specifications using the same match criteria as the
64 \fBremove\fR command but without the requirement that at least one of
65 \fIvendor\fR, \fIpublisher\fR, \fIclass\fR, \fIusername\fR or \fIpath\fR be
66 specified. With no match criteria, all specifications are listed. The list
67 command output format is: [vendor=\fIvendor\fR] [publisher=\fIpublisher\fR]
68 [class=\fIclass\fR] [subclass=\fIsubclass\fR] [username=\fIusername\fR]
69 \fIpath\fR [\fIargs\fR] where each of \fIclass\fR, \fIsub-class\fR,
70 \fIvendor\fR, \fIpublisher\fR and \fIusername\fR is listed only if part of the
71 match criteria for the listed specification.
74 The \fBsyseventadm\fR \fBrestart\fR command informs the \fBsyseventd\fR daemon
75 to reread the \fBsysevent\fR registry after a change has been made by adding or
76 removing one or more \fBsysevent\fR handler specifications.
77 .SS "Argument Macro Substitution"
80 The \fBsysevent\fR handling facility provides extensive macro capability for
81 constructing the command line arguments to be executed in response to an event.
82 Macro expansion applies only to the command line \fIargs\fR specified for an
83 event handler, with macros expanded with data from the event itself.
84 Pre-defined macros are provided for the event \fIclass\fR, \fIsubclass\fR,
85 \fIpublisher\fR and \fIvendor\fR information. Macros not matching one of the
86 pre-defined macro names cause the attribute list attached to the event to be
87 searched for an attribute of that name, with the value of the matching
88 attribute substituted on the command line.
91 Macros are introduced by the \fB$\fR character, with the macro name being the
92 following token separated by a SPACE or TAB character. If the macro name is
93 embedded in text, it may be delineated by \fB${\fR and \fB}\fR. A \fB\e\fR
94 before the \fB$\fR causes macro expansion not to occur.
101 The class string defining the event
107 \fB$\fIpublisher\fR\fR
110 The publisher string defining the event
116 \fB$\fIsequence\fR\fR
119 The sequence number of the event.
125 \fB$\fIsubclass\fR\fR
128 The subclass string defining the event
134 \fB$\fItimestamp\fR\fR
137 The timestamp of the event.
146 The vendor string defining the event
151 Macro names other than those pre-defined are compared against the attribute
152 list provided with the event. An attribute with name matching the macro name
153 causes the value of the attribute to be substituted as \fBASCII\fR text on the
154 generated command line.
157 Use of a macro for which no attribute with that name is defined, or for which
158 multiple attributes with that name are provided, cause an error and the command
162 Attributes with signed data types (\fBDATA_TYPE_INT16\fR, \fBDATA_TYPE_INT32\fR
163 and \fBDATA_TYPE_INT64\fR) are expanded as decimal digits.
166 Attributes with unsigned data types (\fBDATA_TYPE_BYTE\fR,
167 \fBDATA_TYPE_UINT16\fR, \fBDATA_TYPE_UINT32\fR, \fBDATA_TYPE_UINT64\fR and
168 \fBDATA_TYPE_HTTIME\fR) are expanded as hexadecimal digits with a \fB0x\fR
172 Attributes with string data type (\fBDATA_TYPE_STRING\fR) are expanded with the
173 string data. The data is not quoted. If if it desired that the quoted strings
174 be generated on the command line, put quotes around the macro call in the
178 Array types are expanded with each element expanded as defined for that scalar
179 type, with a space separating each element substitution.
183 The \fBadd\fR, \fBlist\fR and \fBremove\fR subcommands support the following
188 \fB\fB-c\fR \fIclass\fR\fR
191 Specify the event class, \fIclass\fR.
197 \fB\fB-p\fR \fIpublisher\fR\fR
200 Specify the event publisher, \fIpublisher\fR.
206 \fB\fB-R\fR \fIrootdir\fR\fR
209 Specify an alternate root path, \fIrootdir\fR.
214 The root file system of any non-global zones must not be referenced with the
215 \fB-R\fR option. Doing so might damage the global zone's file system, might
216 compromise the security of the global zone, and might damage the non-global
217 zone's file system. See \fBzones\fR(5).
224 \fB\fB-s\fR \fIsubclass\fR\fR
227 Specify the event subclass, \fIsubclass\fR.
233 \fB\fB-u\fR \fIusername\fR\fR
236 Specify the username (\fIusername\fR) to invoke the command.
242 \fB\fB-v\fR \fIvendor\fR\fR
245 Specify the vendor (\fIvendor\fR) that defines the event. Events defined by
246 third-party software should specify the company's stock symbol as \fIvendor\fR.
247 Sun-defined events use \fBSUNW\fR.
253 The \fBadd\fR, \fBlist\fR and \fBremove\fR subcommands support the following
270 Full path of command to be run in response to event
275 \fBExample 1 \fRAdding an Event Handler
278 The following example adds an event handler for an event defined by vendor
279 \fBMYCO\fR ("My Company"), class \fBEC_ENV\fR and sub-class \fBESC_ENV_TEMP\fR.
280 The command to be run is \fB/opt/MYCOenv/bin/ec_env_temp\fR, with arguments
281 being the class name, sub-class name and pathname derived from the event
282 attributes. The \fB$\fR characters are preceded by a backslash to circumvent
283 shell interpretation. There is no need to restart the service after the change
284 since the registry is maintained on \fB$ALTROOT\fR.
289 # syseventadm add -R \$ALTROOT -v MYCO -c EC_ENV -s ESC_ENV_TEMP \e
290 /opt/MYCOenv/bin/ec_env_temp \e$class \e$subclass \e$pathname
297 Note the caveat on the use of the \fB-R\fR option in the description of that
301 \fBExample 2 \fRRemoving an Event Handler
304 The following example removes the event handler added in Example 1.
309 # syseventadm remove -R \$ALTROOT -v MYCO -c EC_ENV -s ESC_ENV_TEMP \e
310 /opt/MYCOenv/bin/ec_env_temp \${class} \${subclass} \${pathname}
317 Note the caveat on the use of the \fB-R\fR option in the description of that
321 \fBExample 3 \fRListing Event Handlers
324 The following example lists all event handlers for events of class
325 \fBEC_ENV\fR, subclass \fBESC_ENV_TEMP\fR, as defined by vendor \fBMYCO\fR:
330 # syseventadm list -v MYCO -c EC_ENV -s ESC_ENV_TEMP \e
331 vendor=MYCO class=EC_ENV subclass=ESC_ENV_TEMP \e
332 /opt/MYCOenv/bin/ec_env_temp \e${class} \e${subclass} \e${pathname}
338 \fBExample 4 \fRListing Event Handlers
341 The following example lists all event handlers defined by vendor \fBVRTS\fR.
346 # syseventadm list -v VRTS
352 \fBExample 5 \fRRemoving Event Handlers
355 The following example removes all event handlers defined by vendor \fBVRTS\fR,
356 and restarts service.
361 # syseventadm remove -v VRTS
362 # syseventadm restart
368 \fBExample 6 \fRListing All Event Handlers Specified to Run a Command
371 The following example lists all event handlers specified to run the command
372 \fB/opt/MYCOenv/bin/ec_env_temp\fR:
377 # syseventadm list /opt/MYCOenv/bin/ec_env_temp
383 \fBExample 7 \fRRemoving Event Handlers and Restarting Service
386 The following example removes all event handlers specified to run the command
387 \fB/opt/MYCOenv/bin/ec_env_temp\fR, and restarts service:
392 # syseventadm remove /opt/MYCOenv/bin/ec_env_temp
393 # syseventadm restart
401 The following exit values are returned:
408 Successful completion.
417 No matching event specification found (remove or list commands only).
426 Incorrect command usage.
459 \fBsyseventd\fR(8), \fBsysevent_post_event\fR(3SYSEVENT), \fBattributes\fR(5),
460 \fBddi_log_sysevent\fR(9F)
464 To avoid upgrade problems, packages delivering a sysevent event handler should
465 install the event handler by running \fBsyseventadm\fR from the package's
466 postinstall script. The event handler can then be removed by running
467 \fBsyseventadm\fR from the package's preremove script using the same arguments