1newtask(1) User Commands newtask(1)
2
3
4
6 newtask - create new task and optionally change project
7
9 newtask [-p project] [-v] [-c pid | [-Fl] [command...]]
10
11
13 The newtask command executes the user's default shell or a specified
14 command, placing the executed command in a new task owned by the speci‐
15 fied project. The user's default shell is the one specified in the
16 passwd database, and is determined using getpwnam().
17
18
19 Alternatively, newtask can be used to cause an already running process
20 to enter a newly created task. A project for the new task can also be
21 specified in this form of the command. This might be desirable for pro‐
22 cesses that are mission critical and cannot be restarted in order to
23 put them into a new project.
24
25
26 In the case that extended accounting is active, the newtask command can
27 additionally cause the creation of a task accounting record marking the
28 completion of the preceding system task.
29
31 The following options are supported:
32
33 -c pid Cause a running process to enter a newly created task. A
34 project for the new task can also be specified using the -p
35 option. The invoking user must either own the process or have
36 super-user privileges.
37
38 If the project is being changed, the process owner must be a
39 member of the specified project, or the invoking user must
40 have super-user privileges. When the project is changed for a
41 running process, its pool binding as well as resource con‐
42 trols are modified to match the configuration of the new
43 project. Controls not explicitly specified in the project
44 entry is preserved.
45
46 This option is incompatible with the -F and -l options.
47
48
49 -F Creates a finalized task, within which further newtask or
50 settaskid(2) invocations would fail. Finalized tasks can be
51 useful at some sites for simplifying the attribution of
52 resource consumption.
53
54
55 -l Changes the environment to what would be expected if the user
56 actually logged in again as a member of the new project.
57
58
59 -p Changes the project ID of the new task to that associated
60 with the given project name. The invoking user must be a
61 valid member of the requested project, or must have super-
62 user privileges, for the command to succeed. If no project
63 name is specified, the new task is started in the invoking
64 user's current project.
65
66
67 -v Verbose: displays the system task id as the new system task
68 is begun.
69
70
72 The following operands are supported:
73
74 project The project to which resource usage by the created task
75 should be charged. The requested project must be defined in
76 the project databases defined in nsswitch.conf(4).
77
78
79 command The command to be executed as the new task. If no command is
80 given, the user's login shell is invoked. (If the login
81 shell is not available, /bin/sh is invoked.)
82
83
85 Example 1 Creating a New Shell
86
87
88 The following example creates a new shell in the canada project, dis‐
89 playing the task id:
90
91
92 example$ id -p
93 uid=565(gh) gid=10(staff) projid=10(default)
94 example$ newtask -v -p canada
95 38
96 example$ id -p
97 uid=565(gh) gid=10(staff) projid=82(canada)
98
99
100
101 Example 2 Running the date Command
102
103
104 The following example runs the date command in the russia project:
105
106
107 example$ newtask -p russia date
108 Tue Aug 31 11:12:10 PDT 1999
109
110
111
112 Example 3 Changing the Project of an Existing Process
113
114
115 The following example changes the project of the existing process with
116 a pid of 9999 to russia:
117
118
119 example$ newtask -c 9999 -p russia
120
121
122
124 The following exit values are returned:
125
126 0 Successful execution.
127
128
129 1 A fatal error occurred during execution.
130
131
132 2 Invalid command line options were specified.
133
134
136 /etc/project Local database containing valid project definitions for
137 this machine.
138
139
140 /proc/pid/* Process information and control files.
141
142
144 See attributes(5) for a description of the following attributes:
145
146
147
148
149 ┌─────────────────────────────┬─────────────────────────────┐
150 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
151 ├─────────────────────────────┼─────────────────────────────┤
152 │Availability │SUNWcsu │
153 └─────────────────────────────┴─────────────────────────────┘
154
156 proc(1), id(1M), poolbind(1M), execvp(2), setrctl(2), settaskid(2),
157 setproject(3PROJECT), nsswitch.conf(4), proc(4), project(4),
158 attributes(5)
159
160
161
162SunOS 5.11 17 Nov 2004 newtask(1)