Go to main content

マニュアルページ セクション 1: ユーザーコマンド

印刷ビューの終了

更新: 2022年7月27日
 
 

newtask(1)

名前

newtask - タスクの新規作成とオプションでのプロジェクト変更

形式

newtask [-p project [–d]] [-v | -o file] [-c pid | [-Fl] [command...]]

説明

The newtask command executes the user's default shell or a specified command, placing the executed command in a new task owned by the specified project.The user's default shell is the one specified in the passwd database, and is determined using getpwnam().

また、newtask では、すでに実行されているプロセスを使用すると、新しく作成したタスクを入れることができます。新しいタスク用のプロジェクトもこの形式のコマンドで指定できます。これは、非常に重要で再起動できないプロセスを新しいプロジェクトに配置するのに適しています。

また、拡張アカウンティングがアクティブな場合に newtask コマンドを使用すると、タスクのアカウンティングレコードを作成して、先行するシステムタスクの完了をマークすることもできます。

オプション

サポートしているオプションは、次のとおりです。

–c pid

実行中のプロセスを新しく作成したタスクに入れます。また、–p オプションを使用すると、新しいタスク用のプロジェクトを指定できます。The invoking user must either own the process or have the required privileges listed in setproject(3PROJECT).

If the project is being changed, the process owner must be a member of the specified project, or the invoking user must have the required privileges listed in setproject(3PROJECT).

実行中のプロセスのプロジェクトが変更されると、プロジェクト属性が適用され、それによってリソース制御、リソースプールバインディング、およびマルチ CPU バインディング (MCB) が更新される可能性があります。プロジェクト属性が適用される仕組みの詳細については、setproject(3PROJECT) のマニュアルページを参照してください。

このオプションは、–F および –l オプションと同時には使用できません。

–d

プロジェクトで project.pool 属性を指定していない場合、ゾーンのデフォルトのプールにバインドします。Requires –p.これにより既存のプールまたは pset バインディングが上書きされます。This option is useful if the target process has been manually bound to a pool or pset, a project does not specify a project.pool attribute, and the system administrator wishes to restore the default pool binding for the zone.このオプションを指定せず、プロジェクトで project.pool または project.mcb 属性を指定していない場合、既存のプールまたは pset バインディングが残されます。

–F

ファイナライズタスクを作成します。ファイナライズタスク内では、以降の newtask または settaskid(2) の起動は失敗します。ファイナライズタスクは、一部のサイトでリソース消費の帰属を簡略化する際に役立ちます。

–l

環境を、ユーザーが実際に新しいプロジェクトのメンバーとして再度ログインした場合に得られる環境に変更します。

–o file

Prints the system task ID to file as the new system task is started.If the file can neither be created, nor opened for writing and truncated, newtask will exit immediately without taking any further action. newtask never deletes file.This option is incompatible with the option –v.

–p

新しいタスクのプロジェクト ID を特定のプロジェクト名に関連付けられた ID に変更します。The invoking user must be a valid member of the requested project, or must have the required privileges listed in setproject(3PROJECT), for the command to succeed.プロジェクト名を指定していない場合、新しいタスクは、プロジェクトユーザーの現在のプロジェクト内で開始されます。If –c option is used without –p, then the target process starts a new task in its current project.

–n

–p および –c オプションを必要とします。このオプションは、ターゲットプロセスがすでにプロジェクトに存在する場合は新しいタスクの作成を防止します。プロジェクト属性の適用だけが行われます。

–v

Prints the system task ID to standard error output as the new system task is started.Note that command may generate its own output to standard error.See also the –o option.This option is incompatible with the option –o.

オペランド

次のオペランドがサポートされています。

project

作成したタスクのリソース使用量をチャージするプロジェクト。要求するプロジェクトは、nsswitch.conf(5) で定義されたプロジェクトデータベースで定義されている必要があります。

command

新しいタスクとして実行するコマンド。コマンドを指定しなかった場合、ユーザーのログインシェルが起動されます。ログインシェルが使用できない場合は、/bin/sh が起動されます。

使用例 1 新しいシェルを作成する

次の例では、canada プロジェクトに新しいシェルを作成し、タスク ID を表示しています。

example$ id -p
uid=565(gh) gid=10(staff) projid=10(default)
example$ newtask -o idfile -p canada
example$ echo $(cat idfile)
38
example$ id -p
uid=565(gh) gid=10(staff) projid=82(canada)
使用例 2 date コマンドを実行する

次の例では、russia プロジェクトで date コマンドを実行しています。

example$ newtask -p russia date
Tue Aug 31 11:12:10 PDT 1999
使用例 3 既存プロセスのプロジェクトを変更する

The following example changes the project of the existing process with a PID of 9999 to russia:

example$ newtask -c 9999 -p russia

終了ステータス

次の終了ステータスが返されます。

0

Successful execution.

1

実行中に致命的なエラーが発生した。

2

無効なコマンド行オプションが指定された。

ファイル

/etc/project

このマシンの有効なプロジェクト定義を含むローカルデータベース。

/proc/pid/*

プロセス情報および制御ファイル。

属性

属性についての詳細は、attributes(7) を参照してください。

属性タイプ
属性値
使用条件
system/core-os

関連項目

proc(1), execvp(2), setrctl(2), settaskid(2), setproject(3PROJECT), nsswitch.conf(5), proc(5), project(5), attributes(7), privileges(7), id(8), poolbind(8)