beautypg.com

1 running an ssh command, 2 running a linux script – HP Insight Control Software for Linux User Manual

Page 153

background image

16.4 Using Insight Control for Linux to run commands and scripts through
SSH

The following menu items enable you to run a script or command through SSH to one or more
managed systems:

Tools

Command Line ToolsRun SSH Command...

Tools

Command Line ToolsRun Script...

16.4.1 Running an SSH command

The Tools

Command Line ToolsRun SSH Command... runs a command on a target server.

This tool operates on the target server by opening a secure shell (SSH) connection to the target
server, running the command, capturing Stdout and Stderr from the command, capturing the
return code from the command, and closing the SSH connection.

You must define SSH credentials into HP SIM for the target server in order to use this menu
item.

Select the following menu item from the HP Insight Control user interface to update the SSH
Settings

for one or more target managed systems:

Options

Protocol SettingsSystem Protocol Settings

IMPORTANT:

Any HP SIM user that has access to this tool can run any command on the target

managed system with the privileges of the user you entered into the System Protocol Settings
page. If you entered the root user and password into the System Protocol Settings, any HP
SIM user with access to this tool also has root privileges on the target managed system.

To run an SSH command on one or more managed systems, follow this procedure:

1.

Before you begin, ensure that the command you intend to run does not leave any open file
descriptors upon completion (including called scripts).

Open file descriptors might prevent the SSH connection from closing properly and might
cause the task to remain in a Running state indefinitely.

2.

Select the following menu item from the HP Insight Control user interface:

Tools

Command Line ToolsRun SSH Command...

3.

Select one or more target managed systems.

4.

Enter the command you want to run. Enter multiple commands on one line and separate
each command with a semicolon (;). The maximum length of a command is 255 characters.

5.

Select Run Now to run the command immediately. Or, select Schedule to schedule the task
to occur in the future

6.

Select the following menu item from the HP Insight Control user interface to view the task
results:

Tasks & Logs

View Task Results...

From the Task Results page, view the log for the command, which includes Stdout and
Stderr from the command.

The return code from the SSH command controls the final state of the task. If the return code
from the command indicates failure, the task is in a Failed state. If the return code from
the command indicates success, the task is in a Complete state.

16.4.2 Running a Linux script

The Tools

Command Line ToolsRun Script... menu item remotely runs a Linux script in

the Insight Control for Linux

repository

by opening a secure shell (SSH) connection to one or more

16.4 Using Insight Control for Linux to run commands and scripts through SSH

153