Sun Management Center Change Manager 1.0 Administration Guide

Accessing the Change Manager Server by Using the Command-Line Interface

To use the command-line interface of Change Manager, you need to access the Change Manager server as an authenticated user. Therefore, you must log in to the Change Manager server. The following procedures show you how to use the command-line interface to perform authorized Change Manager operations. See the changemgr(1MCM) man page.

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

How to Authenticate a User (Command Line)

  1. Authenticate the user for any one of the changemgr commands.

    You can run the changemgr help commands as an unauthenticated user.

  2. To control user authentication, use the -u username option with the -p file option.

    • If the -u option is not specified, then the user is the current UNIX user. In this case, you can supply a file with your password to the -p option.

    • If the -p option is not specified, then the user is prompted for his password.

Example-Using Default User Authentication With No Password File

Suzi creates a folder as herself. She does not specify a file with her password in it.


$ changemgr mkdir /web-server/apache
Password: Suzi's password
$ 

Example-Using Default User Authentication With a Password File

Suzi creates a folder as herself. She specifies a file with her password in it to authenticate.


$ changemgr mkdir -p .pfile /web-server/apache

Example-Authenticating Another User

Suzi creates a folder as root.


$ changemgr mkdir -u root /web-server/apache
Password: root password
$