Sun Management Center Change Manager 1.0 Administration Guide

- Previous: Maintaining the Change Manager Repository by Using the Command-Line Interface (Task Map)
- Next: Chapter 9 Maintaining the Change Manager Topology (Tasks)

# Maintaining the Change Manager Repository by Using the Command-Line Interface

This section describes how to use the command-line interface to manage the file hierarchy of the Change Manager repository.

## How to Create a Folder (Command Line)

Note -

The top of the Files section hierarchy is a folder.

1. Determine where to create the folder.

   For example, create a folder in the `web-server` folder.

2. Create and name the folder.

       $ changemgr mkdir [ -u username ] [ -p file ] reldirpath ...

   `-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.

   reldirpath

     Specifies the path to a folder that is relative to the top of the Change Manager repository.

   Choose a meaningful name that indicates the types of files the folder contains. For example, create a folder named `apache` in which to store objects related to the Apache web server.

### Example-Creating a Folder

Suzi creates the `apache` folder in the `web-server` folder.

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

## How to Rename a File or Folder (Command Line)

The rename action can be taken on one file or folder at a time.

1. Determine which file or folder to rename.

   For example, rename the `web-server/apache` folder to be `web-server/ApacheServer`.

2. Rename the file or folder.

       $ changemgr filemove [ -u username ] [ -p file ] old_relfilepath.type \
       new_relfilepath.type

   relfilepath

     Specifies the path to a file or folder. The path is relative to the top of the Change Manager repository.

   .type

     Specifies the file name suffix that represents the file type. File type suffixes are as follows:

     - `.flar` for archives

     - `.miniroot` for boot images

     - `.bmft` for manifests

     - `.brul` for audit rules files

     - `.txt` for reports

     - `.cmsp` for shared profiles

     Folders do not use a file suffix.

   For descriptions of the other options, see How to Create a Folder (Command Line).

### Example-Renaming a File or Folder

Suzi renames the `web-server/apache` folder to be `web-server/ApacheServer`.

    $ changemgr filemove /web-server/apache \
    /web-server/ApacheServer

## How to Export Files to Another System (Command Line)

Only files, not folders and Solaris boot images, can be exported.

1. Determine which files to export.

   For example, export the `/web-server/apache/host1.bmft` file to `host2:/home/suzi`.

2. Export the files:

   - Export a single file, `relfilepath`, from the repository as `filepath`.

          $ changemgr export [ -u username ] [ -p file ] relfilepath filepath

   - Export one or more files to the specified folder, `dirpath`, outside of the repository.

         $ changemgr export [ -u username ] [ -p file ] relfilepath ... dirpath

   dirpath

     Specifies an absolute or relative path to a directory. This directory is not within the Change Manager repository.

   filepath

     Specifies an absolute or relative path to a file. This file path is not within the Change Manager repository.

   relfilepath

     Specifies the path to a file, not including a folder, that is relative to the top of the Change Manager repository.

   For descriptions of the other options, see How to Create a Folder (Command Line).

### Example-Exporting a File to Another System

Suzi exports the `/web-server/apache/host1.bmft` file to her home directory, `/net/host2/home/suzi`.

    $ changemgr export /web-server/apache/host1.bmft \
    /net/host2/home/suzi/host1.bmft

### Example-Exporting Files to Another System

Suzi exports the `/web-server/apache/host1.bmft` file and the `/web-server/apache/host2.bmft` file to her home directory, `/net/host2/home/suzi`.

    $ changemgr export /web-server/apache/host1.bmft \
    /web-server/apache/host2.bmft /net/host2/home/suzi

## How to Move Files and Folders to Another Folder (Command Line)

1. Determine which files and folders to move.

   For example, move the `web-server/host1.bmft` file and the `web-server/host2.bmft` file to the `web-server/ApacheServer` folder.

2. Move the files and folders to another folder in the Change Manager repository.

       $ changemgr filemove [ -u username ] [ -p file ] relfilepath ... \
       reldirpath

   relfilepath

     Specifies the path to a file or folder that is relative to the top of the Change Manager repository.

   For descriptions of the other options, see How to Create a Folder (Command Line).

### Example-Moving Files and Folders to Another Folder

Suzi moves the `web-server/host1.bmft` file and the `web-server/host2.bmft` file to the `web-server/ApacheServer` folder.

    $ changemgr filemove /web-server/host1.bmft \
    /web-server/host2.bmft /web-server/ApacheServer

## How to Delete Files and Folders (Command Line)

Folders must be empty before you delete them.

1. Determine which files and folders to delete.

   For example, delete the `web-server/host1.bmft` file, the `host2.bmft` file, and the `web-server/ApacheServer` folder.

2. Delete the files and folders.

       $ changemgr delete [ -u username ] [ -p file ] relfilepath ...

   relfilepath

     Specifies the path to a file or folder that is relative to the top of the Change Manager repository.

   For descriptions of the other options, see How to Create a Folder (Command Line).

### Example-Deleting Files and Folders

Suzi deletes the `web-server/host1.bmft` file, the `host2.bmft` file, and the `web-server/ApacheServer` folder.

    $ changemgr delete /web-server/host1.bmft \
    /web-server/host2.bmft /web-server/ApacheServer

## How to View Folder Contents (Command Line)

A folder can contain files and other folders.

To modify folder properties, see How to Modify File or Folder Properties (Command Line).

1. Determine which folder to view.

   For example, view the contents of the `web-server/ApacheServer` folder.

2. View the folder contents.

       $ changemgr files [ -u username ] [ -p file ] [ -l ] [ -d ] [ -R ] \
       [ -o format ] [ relfilepath ... ]

   `-l`

     Present detailed information in tabular form.

   `-d`

     Present information about the folder itself, rather than about the folder's contents.

   `-R`

     Describe all the folder's descendents.

   `-o` format

     format is a blank-separated list or comma-separated list of property names. If you separate the property names with spaces, make sure that you surround the list of property names with quotes. The specified property values are displayed in a name-value format. If format is specified as `all`, then all properties are displayed. The output is suitable for programmatic parsing.

   relfilepath

     Specifies the path to a file or folder that is relative to the top of the Change Manager repository.

   For descriptions of the other options, see How to Create a Folder (Command Line).

### Example-Viewing Contents of the Root of the Repository

Suzi views the contents of the root of the Change Manager repository, which is the root folder.

    $ changemgr files

### Example-Viewing Folder Contents

Suzi views the contents of the `web-server/ApacheServer` folder.

    $ changemgr files /web-server/ApacheServer

### Example-Viewing Information About the Folder

Suzi views the information about the `web-server/ApacheServer` folder.

    $ changemgr files -d /web-server/ApacheServer

### Example-Viewing Folder Contents in Table Form

Suzi views the contents of the `web-server/ApacheServer` folder in table form.

    $ changemgr files -l /web-server/ApacheServer

### Example-Viewing Folder Contents and Contents of the Folder's Descendents

Suzi views the contents of the `web-server/ApacheServer` folder and the folder's descendents.

    $ changemgr files -R /web-server/ApacheServer

### Example-Viewing Folder Contents and Specific Properties

Suzi views the contents of the `web-server/ApacheServer` folder. She wants to see the values of the `Description` property and the `save` property for each object. Note that you can use either format shown.

    $ changemgr files -o Description,save /web-server/ApacheServer

    $ changemgr files -o "Description save" /web-server/ApacheServer

### Example-Viewing Folder Contents and All Properties

Suzi views the contents of the `web-server/ApacheServer` folder and wants to see the values of all the properties for each object.

    $ changemgr files -o all /web-server/ApacheServer

### Example-Viewing Detailed Information About the Contents and Properties of a Folder and Its Descendents

Suzi views detailed information in table form about the contents and all properties of the `web-server/ApacheServer` folder and the folder's descendents.

    $ changemgr files -l -R -o all /web-server/ApacheServer

## How to View File or Folder Properties (Command Line)

1. To view file or folder properties, see How to View Folder Contents (Command Line).

## How to Modify File or Folder Properties (Command Line)

1. Determine which file or folder properties you want to modify.

   - File - For example, modify the properties of the `web-server/ApacheServer/ApacheWebServer.flar` file.

   - Folder - For example, modify the properties of the `web-server/ApacheServer` folder.

2. To modify the properties, supply the property names and values.

       $ changemgr fileset [ -u username ] [ -p file ] [ -s name=value ]  ... \
       [ -s name ] ... relfilepath ...

   `-s` name=value

     Specify one or more name-value pairs. name is the property name, and value is the property value. Supply this option for each property value you want to set. If value is blank, then the property is assigned an empty value.

   `-s` name

     Specify one or more property names to delete, where name is the property name. Supply this option for each property you want to delete.

   relfilepath

     Specifies the path to a file or folder that is relative to the top of the Change Manager repository.

   For descriptions of the other options, see How to Create a Folder (Command Line).

### Example-Modifying File Properties

Suzi modifies the `Description` property of the `web-server/ApacheServer/ApacheWebServer.flar` file.

    $ changemgr fileset -s Description="Apache Web Server archive" \
    /web-server/ApacheServer/ApacheWebServer.flar

### Example-Deleting a File Property

Suzi deletes the `Description` property of the `web-server/ApacheServer/ApacheWebServer.flar` file.

    $ changemgr fileset -s Description \
    /web-server/ApacheServer/ApacheWebServer.flar

### Example-Deleting File Properties

Suzi deletes the `Description` property and the `Name` property from the `web-server/ApacheServer/ApacheWebServer.flar` file.

    $ changemgr fileset -s Description -s Name \
    /web-server/ApacheServer/ApacheWebServer.flar

### Example-Deleting a File Property From One or More Files

Suzi deletes the `Description` property from the `web-server/ApacheServer/ApacheWebServer.flar` file and the `web-server/ApacheServer/ApacheWebServer.txt` file.

    $ changemgr fileset -s Description \
    /web-server/ApacheServer/ApacheWebServer.flar \
    /web-server/ApacheServer/ApacheWebServer.txt

### Example-Recursively Setting Folder Properties

Suzi recursively sets the `Description` property of the contents of the `web-server/Apache Server` folder.

    $ changemgr fileset -R \
    -s Description="File related to the Apache Web Server" \
    /web-server/ApacheServer

### Example-Modifying Folder Properties

Suzi modifies the `Description` property of the `web-server/Apache Server` folder.

    $ changemgr fileset \
    -s Description="Folder to hold Apache Web Server files" \
    /web-server/ApacheServer

- Previous: Maintaining the Change Manager Repository by Using the Command-Line Interface (Task Map)
- Next: Chapter 9 Maintaining the Change Manager Topology (Tasks)

- © 2010, Oracle Corporation and/or its affiliates