Configuring z/VM CP commands as a shutdown action
Use chshut and dumpconf to configure a CP command as a shutdown action, or directly write to the relevant sysfs attributes.
Before you start: This information applies to Linux® on z/VM
only.
In sysfs, two attributes are required to set a z/VM CP
command as a shutdown action for a trigger <trigger>:
- /sys/firmware/shutdown_actions/on_<trigger> must be
set to
vmcmd
. - /sys/firmware/vmcmd/on_<trigger> specifies the z/VM CP command.
The values of the attributes in the /sys/firmware/vmcmd directory must
conform to these rules:
- The value must be a valid z/VM CP command.
- The commands, including any z/VM user IDs or device numbers, must be specified with uppercase characters.
- Commands that include blanks must be delimited by double quotation marks (").
- The value must not exceed 127 characters.
You can specify multiple z/VM CP commands that are
separated by the newline character
\n. Each newline is counted as one character. When writing values with multiple commands, use this syntax to ensure that the newline character is processed correctly:
# echo -e <cmd1>\n<cmd2>... | cat > /sys/firmware/vmcmd/on_<trigger>
where
<cmd1>\n<cmd2>...
are two or more z/VM CP commands and
on_<trigger>
is one of the attributes in the
vmcmd directory.The -e echo option and redirect through cat are required because of the newline character.
Example for a single z/VM CP command
Issue the following command to configure the z/VM CP LOGOFF
command as the shutdown action for the
poff
shutdown
trigger.# chshut poff vmcmd "LOGOFF"
Alternatively, you can issue the following commands to directly write the shutdown configuration
to
sysfs:
# echo vmcmd > /sys/firmware/shutdown_actions/on_poff
# echo LOGOFF > /sys/firmware/vmcmd/on_poff
Figure 1 illustrates the relationship of the sysfs attributes
for this example.
Example for multiple z/VM CP commands
Issue the following command to configure two z/VM CP
commands as the shutdown action for the
poff
shutdown trigger. First a message is
sent to user OPERATOR, and then the LOGOFF command is
issued.# chshut poff vmcmd "MSG OPERATOR Going down" vmcmd "LOGOFF"
Alternatively, you can issue the following commands to directly write the shutdown configuration
to
sysfs:
# echo vmcmd > /sys/firmware/shutdown_actions/on_poff
# echo -e "MSG OPERATOR Going down\nLOGOFF" | cat > /sys/firmware/vmcmd/on_poff