System Administration Guide: Resource Management and Network Services

Project Administration Examples

How to Define a Project and View the Current Project

This example shows how to use the projadd and projmod commands.

  1. Become superuser.

  2. View the default /etc/project file on your system.


    # cat /etc/project
    system:0::::
    user.root:1::::
    noproject:2::::
    default:3::::
    group.staff:10::::
  3. Add a project called booksite and assign it to a user named mark with project ID number 4113.


    # projadd -U mark -p 4113 booksite
    
  4. View the /etc/project file again to see the project addition.


    # cat /etc/project
    system:0::::
    user.root:1::::
    noproject:2::::
    default:3::::
    group.staff:10::::
    booksite:4113::mark::
  5. Add a comment that describes the project in the comment field.


    # projmod -c `Book Auction Project' booksite
    
  6. View the changes in the /etc/project file.


    # cat /etc/project
    system:0::::
    user.root:1::::
    noproject:2::::
    default:3::::
    group.staff:10::::
    booksite:4113:Book Auction Project:mark::

How to Delete a Project From the /etc/project File

This example shows how to use the projdel command to delete a project.

  1. Become superuser.

  2. Remove the project booksite by using the projdel command.


    # projdel booksite
    
  3. Display the /etc/project file.


    # cat /etc/project
    system:0::::
    user.root:1::::
    noproject:2::::
    default:3::::
    group.staff:10::::
  4. Log in as user mark and type projects to view the projects assigned.


    # su - mark
    # projects
    default

How to Obtain User and Project Membership Information

Use the id command with the -p flag to view the current project membership of the invoking process.


$ id -p
uid=100(mark) gid=1(other) projid=3(default)

How to Create a New Task

  1. Become superuser.

  2. Create a new task in the booksite project by using the newtask command with the -v (verbose) option to obtain the system task ID.


    # newtask -v -p booksite
    16

    The execution of newtask creates a new task in the specified project, and places the user's default shell in this task.

  3. View the current project membership of the invoking process.


    # id -p
    uid=100(mark) gid=1(other) projid=4113(booksite)

    The process is now a member of the new project.

How to Move a Running Process Into a New Task

This example shows how to associate a running process with a different task and project. To perform this task, you must either be superuser, or be the owner of the process and be a member of the new project.

  1. Become superuser.

  2. Obtain the process ID of the book_catalog process.


    # pgrep book_catalog
    	8100
  3. Associate process 8100 with a new task ID in the booksite project.


    # newtask -v -p booksite -c 8100
    	17

    The -c option specifies that newtask operate on the existing named process.

  4. Confirm the task to process ID mapping.


    # pgrep -T 17
    	8100