rosh utility

The Remote SA Shell (rosh) command makes a client connection that enables you to remotely run programs on managed servers. You invoke the rosh command from within a Global Shell session.

rosh syntax

For servers, the rosh command has the following syntax:

rosh (-n server-name | -i server-id)[-d dir] [-l login-name]
[-s] [-t | -T] [command [arg ...]]

For network devices, the rosh command has the following syntax:

rosh (-n device-name | -i device-id) [-N] [-C comment]
[-L] [-P parameters] [-s] -[-V variables] [command [arg ...]]

The following table describes the rosh options of the preceding syntax statements.

Rosh Options and Commands

Option

Description

-3  

-C comment

A comment for the log of a network script invocation.

-d dir

Sets the working directory (path) on the remote server. The default is the remote user’s home directory.

-D

 

-h

 

-i server-id

Specifies the server by its ID, which must already exist in the
/opsw/.Server.ID directory.

-l login-name

Specifies the login name of the remote user who performs operations on a remote server, which must already exist in the
/opsw/Server directory.

-L

The network script should be run line-by-line.

-m

Network device mode.

-n server-name

Specifies the server by its name, which must already exist in the /opsw/Server directory.

-N

The -i or -n option refers to a network device instead of a server.

-P parameters

Parameters for a network advanced script.

-r

Relays RDP data to a managed server (on Windows).

-s script-name

Treats a command as the name of a saved script that will be sent to and run on the remote server.

-t

Forces the remote session to run in a pseudo terminal (for UNIX servers only).

-T Forces the remote session to run without a pseudo terminal (for UNIX servers only).
-v  
-V variables Variables for a network command or advanced script.

-w seconds

Inactivity time out.

-W seconds

Overall time out.

command
[args . . .]

Runs a program or saved script.

rosh usage rules

The following usage rules apply to the rosh program:

  • Specify either the -n or -i option to log into or run programs on a managed server. These options are mutually exclusive, but if both are specified the -i option has precedence.
  • If neither the -n, -i, and id options are specified, the managed server can be inferred if your working directory is at or below:
    /opsw/Server/.../server-name/

    Or

    /opsw/.Server.ID/server-id/
  • If -r is specified, no other option (excluding -n or -i) can be specified.
  • If -l is not specified, the login-name can be inferred if your working directory is at or below:

    /opsw/Server/.../server-name/files/login-name/

    Or

    /opsw/.Server.ID/server-id/files/login-name/
  • If -s is specified and command  is a saved shared script with a setuid policy, the login-name specified by the -l option will be overridden. In this case, the -l option may be omitted. These scripts are stored in /opsw/Script/Shared.
  • If your working directory is not below server/files/login-name  and -d is not specified, the cwdpath defaults to the home directory for login-name. To default to the home directory, you must specify -l.
  • For network scripts, if your current working directory is below a network device directory in the OFGS, you do not need to specify the device with -N, -n or -i. The network device is implied by the current working directory.
  • For network scripts, if the full path of the script is not specified, rosh uses the search path indicated by the NETWORK_SCRIPT_PATH environment variable. If this variable is not set, rosh searches for the script in these directories:
    /opsw/Script/Network/Command/
    /opsw/Script/Network/Diagnostic/
    /opsw/Script/Network/Advanced/

rosh operations

The rosh command establishes a client connection that enables you to remotely run programs on managed servers. The SA Global Shell feature provides the following modes of operation for rosh:

  • jump: This operation starts a shell session in a pseudo-terminal on a managed server. This mode operates when you do not use the -s option and when you do not specify a command or a script. You must have the loginToServer permission on the managed server to jump.
  • reach: This is a remote execution of commands that are native to the platform (operating system) of the managed server. This mode operates when you specify a command. You must have the runCommandOnServer permission on the managed server to reach.
  • push: This is a remote execution of a script on a managed server. The script is stored in the OGFS and is sent to the managed server by rosh. You must have therunCommandOnServerpermission on the managed server.

rosh examples

The following examples illustrate what these operations look like for an SA user named psi at this path:

/opsw/Server/@/salish.snv1.corp.opsware.com/files/root/etc
 
[psi@m168 etc](538) $ uname -n; id; pwd
m168.dev.opsware.com
uid=59796(psi) gid=59796(psi) groups=59796(psi) 
/opsw/Server/@/salish.snv1.corp.opsware.com/files/root/etc

The rosh jump command would display the following information about the managed server:

[psi@m168 etc](539) $ rosh
[root@salish etc]# uname -n; id; pwd 
salish.snv1.corp.opsware.com
uid=0(root) gid=0(root) 
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),12(mail),7(lp),4(adm),9(kmem),6(disk),5(tty),3(sys),2(daemon),8(mem)
/etc
[root@salish etc]# logout

The rosh reach command displays the following information about the managed server:

[psi@m168 etc](541) $ rosh "uname -n; id; pwd" 
salish.snv1.corp.opsware.com
uid=0(root) gid=0(root) 
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),12(mail),7(lp),4(adm),9(kmem),6(disk),5(tty),3(sys),2(daemon),8(mem)
/etc

The rosh push command displays the following information about the managed server:

[psi@m168 etc](544) $ cat /tmp/who.sh
#!/bin/sh
uname -n
id
pwd
 
[psi@m168 etc](543) $ rosh -s /tmp/who.sh 
salish.snv1.corp.opsware.com
uid=0(root) gid=0(root) 
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),12(mail),7(lp),4(adm),9(kmem),6(disk),5(tty),3(sys),2(daemon),8(mem)
/etc

The following example runs a script on a network device:

$ cd /opsw/Network/@/sw-ee-1-2b
$ rosh -s -C 'Updating device location' \
-V 'Location=Opsware - Sunnyvale' 'Set Location'
run script task 8725081 completed successfully.

Results:

Script 'Set Location for Cisco IOS configuration (for drivers:  Cisco switches, Catalyst 2950, 3550, 3750 & 8500 series, IOS version 12.x)' completed.