Installing and Administering Solaris Container Manager 3.6.1

Moving or Starting Processes in a Project

If the application being managed by the project does not have a unique executable name, then you will want to move processes into the project manually. This method ensures that you track only the processes of the desired application.

ProcedureTo Move Processes Into an Application-Based Project Individually

Use this procedure if you did not provide a match expression for an application-based project and want to move the application's processes into the project individually.

Steps
  1. Create an application-based project for managing the application. Select the Do Not Use Match Expression check box.

    For detailed steps, see the section, To Create an Application-Based Project.

  2. Review the/etc/project file to determine the project name by typing:


    % cat /etc/project
    

    You will need this project name in Step 5.

  3. If needed, start the application in a terminal window.

  4. Determine the processes that correspond to the application.

    For examples, see Example 4–1, Example 4–2, and Example 4–3.

  5. Move the corresponding processes.

    1. From the Container Manager GUI, click the host in the navigation window.

    2. Click the Projects tab.

      The Projects table is shown.

    3. In the Projects table, click the project name. Note that the project name is underlined to show it is a link.

      The Projects Properties tab is shown.

    4. Click the Processes tab.

      The Processes table is shown.

    5. Select the processes to be moved.

    6. Click the Move button.

      The Move Process dialog box appears.

    7. Select the new project (containers) for the process from the list of projects (containers).

    8. Click OK.

  6. Repeat Step 5 until all processes are moved.


Example 4–4 Verifying That the Processes Were Moved Into the Project With ps

You can use the ps command in combination with grep to verify that the processes have been moved into a container. The following example shows that the processes that were individually moved are now in the container payroll:


% ps -ae -o pid,project,comm | grep payroll
17773    payroll ora_reco_AcctEZ 
17763    payroll ora_pmon_AcctEZ 
17767    payroll ora_lgwr_AcctEZ 


Example 4–5 Verifying That the Processes Were Moved Into the Project With prstat

You can use the command prstat to verify that the processes were moved into a container if you know the project name. In this example, the project name is payroll.


% prstat -J payroll
   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP       
 17773 admin     216M  215M cpu2     1    0   0:05:08  29% ora_reco_AcctEZ/1
 17763 admin     834M  782M sleep    1    0   0:35:02   0% ora_pmon_AcctEZ/1
 17767 admin     364M  352M run      1    0   0:22:05  23% ora_lgwr_AcctEZ/1							

ProcedureTo Start an Application in a Project

Steps
  1. Create an application-based project for managing the application. Select the Do Not Use Match Expression check box.

    For detailed steps, see To Create an Application-Based Project.

  2. Select from the following by the OS version:

    • For the Solaris 8 OS, type:


      % srmuser user_name newtask -p project_name application_name
      

      where user_name is the UNIX user name, and project_name is in the form user.username. In the Solaris 8 OS, because only the user-based container is supported, user_name and project_name are the same.

    • For the Solaris 9 or Solaris 10 OS, type:


      % newtask -p project_name application_name
      

      where project_name is the project that is associated with the container, and application_name is the command that starts the application, including any command arguments.

    The application is started in the container.


Example 4–6 Starting an Application Inside a Container on Solaris 9 or Solaris 10 OS

The following is an example of starting an application named tracks inside a container named music:


% newtask -p music tracks -z 0 mozart.au

where -z 0 mozart.au are the command-line arguments for the application tracks.



Example 4–7 Verifying an Application's Association With a Project

After the application has been started, you can verify which project the application is associated with by typing:


% ps -ae -o pid,project,comm

The following is an example of the output from this command:


  PID  PROJECT COMMAND
...
17771   default ora_smon_SunMC
16246   system rquotad
26760   group.staff /bin/csh
16266   music	 tracks
17777   default ora_d000_SunMC
17775   default ora_s000_SunMC
17769   default ora_ckpt_SunMC

In this example, the application named tracks has PID 16266, the project is music, and the executable is tracks. This is the same application started in Example 4–6.