This example shows how to use the projadd and projmod commands.
Become superuser.
View the default /etc/project file on your system.
# cat /etc/project system:0:::: user.root:1:::: noproject:2:::: default:3:::: group.staff:10:::: |
Add a project that is called booksite and assign it to a user who is named mark with project ID number 4113.
# projadd -U mark -p 4113 booksite |
View the /etc/project file again to check for the project addition.
# cat /etc/project system:0:::: user.root:1:::: noproject:2:::: default:3:::: group.staff:10:::: booksite:4113::mark:: |
Add a comment that describes the project in the comment field.
# projmod -c `Book Auction Project' booksite |
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:: |
This example shows how to use the projdel command to delete a project.
Become superuser.
Remove the project booksite by using the projdel command.
# projdel booksite |
Display the /etc/project file.
# cat /etc/project system:0:::: user.root:1:::: noproject:2:::: default:3:::: group.staff:10:::: |
Log in as user mark and type projects to view the projects that are assigned.
# su - mark # projects default |
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) |
Become superuser.
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.
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.
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.
Become superuser.
Obtain the process ID of the book_catalog process.
# pgrep book_catalog 8100 |
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.
Confirm the task to process ID mapping.
# pgrep -T 17 8100 |