Sun Management Center Change Manager 1.0 Administration Guide

- Previous: Accessing the Change Manager Server by Using the Browser Interface
- Next: How to Authenticate a User (Command Line)

## How to Initiate a Change Manager Session (Command Line)

The `changemgr` command is in the `/opt/SUNWichange/bin` directory, so add this directory to your search path (`$PATH` environment variable).

1. Start a Change Manager session.

       $ changemgr session [ -u username ] [ -p file ] [ -d domain ] \
       [ command [ command-arguments ] ]

   `-u` username

     Specify the user name to authenticate. If this option is not specified, the user is the current UNIX user.

   `-p` file

     file consists of a single line, which contains the password. If file is `-`, then the user can supply the password as standard input.

     If the `-p` option is not supplied, then the `changemgr` command prompts the user for his password.

   `-d` domain

     Specify the administrative domain on which to operate. In the context of a session, the default is the domain specified for the session. If no domain is specified, domain is the user's home domain. By default, domain is the user's home domain.

   command

     Normally, command is a `ksh` or `sh` script that contains Change Manager commands in the form of the command-line interface.

     If `command` is one of the `ksh` or the `sh` shells , you get an interactive session.

   command-arguments

     Specifies the optional arguments to command.

### Example-Initiating an Interactive Change Manager Session

The following command line initiates an interactive Change Manager session that uses the `ksh` command. The session is an authenticated subshell.

    $ changemgr session ksh

### Example-Initiating an Interactive Session by Using the Default Shell

The following command line initiates an interactive Change Manager session that uses the value of `$SHELL` to determine which shell to use. Since the value of `$SHELL` is `/bin/ksh`, then `ksh` is used. The session is an authenticated subshell.

    $ changemgr session

### Example-Running Commands in an Interactive Change Manager Session

The following example shows an interactive Change Manager session. The `changemgr session` command starts a subshell in which you can run authenticated `changemgr` commands.

Suzi uses the command-line interface to purge a completed job from the job queue. This job, `IC_1`, was initiated from the browser interface. When Suzi is done with these tasks, she exits the session by typing `exit` at the subshell prompt.

    $ changemgr session
    Password: Suzi's password
    $ changemgr jobs -l IC_1
    IC_1     succeeded
    $ changemgr ack IC_1
    $ changemgr jobs -l IC_1
    $ exit

### Example-Running Scripts in a Change Manager Session

This example shows how to use the `changemgr session` command to run a script. The command line runs the script called `deploy-web`, which contains the following:

    #/bin/sh
    changemgr import "$1" /web-server
    changemgr fileset -s MediaName=s9.miniroot "$1"
    changemgr hostset -s base_config_flar_archive="/$1" "$2"
    changemgr update "$2"

The following command line runs the `deploy-web` script.

    $ changemgr session deploy-web web.flar host1

- Previous: Accessing the Change Manager Server by Using the Browser Interface
- Next: How to Authenticate a User (Command Line)

- © 2010, Oracle Corporation and/or its affiliates