Manpages

名 前

start−stop−daemon − シ ス テ ム デ ー モ ン プ ロ グ ラ ム の 起 動 、 停 止

書 式

start−stop−daemon [option...] command

説 明

start−stop−daemon は シ ス テ ム レ ベ ル の プ ロ セ ス の 生 成 や 停 止 を 制 御 す る た め に 使 用 さ れ る 。 ま た 、 適 切 な オ プ シ ョ ン を 指 定 す る こ と で 、 実 行 中 の プ ロ セ ス を 確 認 す る こ と が で き る 。

Note: unless −−pid or −−pidfile are specified, start−stop−daemon behaves similar to killall(1). start−stop−daemon will scan the process table looking for any processes which match the process name, parent pid, uid, and/or gid (if specified). Any matching process will prevent −−start from starting the daemon. All matching processes will be sent the TERM signal (or the one specified via −−signal or −−retry) if −−stop is specified. For daemons which have long−lived children which need to live through a −−stop, you must specify a pidfile.

コ マ ン ド

−S, −−start [−−] arguments 指 定 さ れ た プ ロ セ ス の 存 在 を 確 認 す る 。 該 当 す る プ ロ セ ス が 存 在 す る 場 合 、 start−stop−daemon は 何 も せ ず 、 エ ラ ー ス テ ー タ ス 1 を 返 し て 終 了 す る (−−oknodo が 指 定 さ れ た 場 合 は 、 0 を 返 す )。 該 当 す る プ ロ セ ス が 存 在 し な い 場 合 、 −−exec に よ り 、 も し く は −−startas が 指 定 さ れ た 場 合 は こ れ に よ り 指 定 さ れ る 実 行 フ ァ イ ル を 起 動 す る 。 コ マ ン ド ラ イ ン 上 で −− 以 降 に 与 え ら れ た 任 意 の 引 数 は 起 動 さ れ る プ ロ グ ラ ム に そ の ま ま 引 き 渡 さ れ る 。
−K
, −−stop 指 定 さ れ た プ ロ セ ス の 存 在 を 確 認 す る 。 該 当 す る プ ロ セ ス が 存 在 す る 場 合 、 start−stop−daemon−−signal に よ り 指 定 さ れ た シ グ ナ ル を そ の プ ロ セ ス に 送 り 、 エ ラ ー ス テ ー タ ス 0 を 返 し て 終 了 す る 。 該 当 す る プ ロ セ ス が 存 在 し な い 場 合 、 start−stop−daemon は エ ラ ー ス テ ー タ ス 1 を 返 し て 終 了 す る ( −−oknodo が 指 定 さ れ た 場 合 は 0 を 返 す )。 −−retry を 指 定 し た 場 合 、 start−stop−daemon は そ の プ ロ セ ス が 終 了 し た こ と を 確 認 す る 。
−T
, −−status

Check for the existence of a specified process, and returns an exit status code, according to the LSB Init Script Actions (since version 1.16.1).

−H, −−help 使 用 方 法 に 関 す る 情 報 を 表 示 し 、 終 了 す る 。
−V
, −−version バ ー ジ ョ ン と 著 作 権 に 関 す る 情 報 を 表 示 し 、 終 了 す る 。

オ プ シ ョ ン

Matching options
−−pid
pid

Check for a process with the specified pid (since version 1.17.6). The pid must be a number greater than 0.

−−ppid ppid

Check for a process with the specified parent pid ppid (since version 1.17.7). The ppid must be a number greater than 0.

−p, −−pidfile pid−file プ ロ セ ス が pid−file を 作 成 し た か ど う か を チ ェ ッ ク す る 。 こ の オ プ シ ョ ン を 単 体 で 使 用 し た 場 合 、 以 前 の プ ロ セ ス が pid−file を 削 除 で き な い ま ま 終 了 し て し ま っ た 際 に 、 意 図 し な い プ ロ セ ス が 動 作 中 で あ る と 判 断 さ れ る 場 合 が あ る た め 留 意 す る こ と 。
−x
, −−exec executable プ ロ セ ス が 指 定 し た executable の イ ン ス タ ン ス で あ る か ど う か を チ ェ ッ ク す る 。 executable 引 数 は 絶 対 パ ス 名 で あ る こ と 。 イ ン タ プ リ タ 型 の ス ク リ プ ト に 対 し て 指 定 し た 場 合 、 executable は イ ン タ プ リ タ 自 体 を 指 し て し ま う た め 、 期 待 す る 動 作 と な ら な い 点 に 留 意 す る こ と 。 chroot 内 で 動 作 し て い る プ ロ セ ス も マ ッ チ し て し ま う た め 、 こ れ 以 外 の 制 約 と の 組 み 合 わ せ が 必 要 と な る 点 に 注 意 す る こ と 。
−n
, −−name process−name プ ロ セ ス が process−name で あ る か ど う か を チ ェ ッ ク す る 。 process−name は 通 常 プ ロ セ ス の フ ァ イ ル 名 で あ る が 、 プ ロ セ ス 自 身 に よ っ て 変 更 す る こ と も 可 能 で あ る 。 大 半 の シ ス テ ム に お い て 、 こ の 情 報 は カ ー ネ ル 内 の process comm name か ら 取 得 さ れ る た め 、 比 較 的 短 い 名 称 で あ る 必 要 が あ る (15 文 字 を 超 え る 名 称 は 移 植 性 が な い と 判 断 さ れ る )点 に 留 意 す る こ と 。
−u
, −−user username|uid プ ロ セ ス が username も し く は uid で 指 定 さ れ た ユ ー ザ の 所 有 と な っ て い る か を チ ェ ッ ク す る 。 こ の オ プ シ ョ ン を 単 体 で 用 い た 場 合 、 指 定 さ れ た ユ ー ザ の 所 有 す る す べ て の プ ロ セ ス が 合 致 す る か を チ ェ ッ ク す る 点 に 留 意 す る こ と 。

Generic options
−g
, −−group group|gid プ ロ セ ス を 開 始 す る 時 点 で 、 groupgid を 変 更 す る 。
−s
, −−signal signal

−−stop と 同 時 に 指 定 す る こ と で 、 プ ロ セ ス を 停 止 す る た め に 送 信 す る シ グ ナ ル を 指 定 す る (デ フ ォ ル ト は TERM)。

−R, −−retry timeout|schedule

−−stop と 同 時 に 指 定 す る こ と で 、 start−stop−daemon に プ ロ セ ス の 終 了 を 確 認 さ せ る 。 こ れ に よ り 、 マ ッ チ し た 実 行 中 の プ ロ セ ス が 全 て 終 了 す る ま で 繰 り 返 し 確 認 が 行 わ れ る 。 プ ロ セ ス が 終 了 し な け れ ば 、 ス ケ ジ ュ ー ル に よ り 指 定 さ れ た ア ク シ ョ ン が 実 行 さ れ る 。

schedule の か わ り に timeout が 指 定 さ れ て い る 場 合 、 signal/timeout/KILL/timeout ス ケ ジ ュ ー ル が 使 わ れ る 。 こ こ で signal−−signal で 指 定 さ れ る シ グ ナ ル で あ る 。 ス ケ ジ ュ ー ル schedule は 、 ス ラ ッ シ ュ (/) で 区 切 ら れ た 少 な く と も 2 つ の 要 素 か ら な る リ ス ト で あ る 。 そ れ ぞ れ の 要 素 は 、 signal−number も し く は []signal−name の 場 合 は 送 る べ き シ グ ナ ル 、 timeout の 場 合 は プ ロ セ ス が 終 了 す る の を 待 つ 秒 数 、 forever の 場 合 は 必 要 な 限 り 、 残 り の schedule を 繰 り 返 し 適 用 す る こ と を 意 味 す る 。

schedule が 終 了 し 、 forever が 指 定 さ れ て い な い 場 合 、 start−stop−daemon は エ ラ ー 状 態 2 で 終 了 す る 。 schedule が 指 定 さ れ て い る 場 合 、 −−signal で 指 定 し た シ グ ナ ル は 無 視 さ れ る 。

−a, −−startas pathname

−−start と 同 時 に 指 定 す る こ と で 、 pathname に よ り 指 定 さ れ る プ ロ セ ス を 起 動 す る 。 こ の オ プ シ ョ ン が 指 定 さ れ な い 場 合 、 −−exec に 与 え ら れ る 引 数 が デ フ ォ ル ト に な る 。

−t, −−test 実 行 し よ う と す る 処 理 内 容 を 出 力 し , そ れ に 伴 い 適 切 な 返 り 値 が 設 定 さ れ る が 、 実 際 の 処 理 は 行 わ な い 。
−o
, −−oknodo 処 理 が 何 も 行 わ れ な い (又 は 、 行 な わ れ な い と 想 定 さ れ る ) 場 合 、 終 了 ス テ ー タ ス 1 の か わ り に 0 を 返 す 。
−q
, −−quiet 情 報 メ ッ セ ー ジ を 出 力 し な い 。 エ ラ ー メ ッ セ ー ジ の み 出 力 す る 。
−c
, −−chuid username|uid[:group|gid]

Change to this username/uid before starting the process. You can also specify a group by appending a :, then the group or gid in the same way as you would for the chown(1) command (user:group). If a user is specified without a group, the primary GID for that user is used. When using this option you must realize that the primary and supplemental groups are set as well, even if the −−group option is not specified. The −−group option is only for groups that the user isn’t normally a member of (like adding per process group membership for generic users like nobody).

−r, −−chroot root プ ロ セ ス を 起 動 す る 前 に 、 root に 対 し て chdir と chroot を 実 行 す る 。 pidfile は chroot 後 に 、 書 き 出 さ れ る こ と に 注 意 す る こ と 。
−d
, −−chdir path

Chdir to path before starting the process. This is done after the chroot if the −r|−−chroot option is set. When not specified, start−stop−daemon will chdir to the root directory before starting the process.

−b, −−background

Typically used with programs that don’t detach on their own. This option will force start−stop−daemon to fork before starting the process, and force it into the background. Warning: start−stop−daemon cannot check the exit status if the process fails to execute for any reason. This is a last resort, and is only meant for programs that either make no sense forking on their own, or where it’s not feasible to add the code for them to do this themselves.

−C, −−no−close

Do not close any file descriptor when forcing the daemon into the background (since version 1.16.5). Used for debugging purposes to see the process output, or to redirect file descriptors to log the process output. Only relevant when using −−background.

−N, −−nicelevel int プ ロ セ ス を 起 動 す る 前 に プ ロ セ ス の プ ラ イ オ リ テ ィ を 変 更 す る 。
−P
, −−procsched policy:priority

This alters the process scheduler policy and priority of the process before starting it (since version 1.15.0). The priority can be optionally specified by appending a : followed by the value. The default priority is 0. The currently supported policy values are other, fifo and rr.

−I, −−iosched class:priority

This alters the IO scheduler class and priority of the process before starting it (since version 1.15.0). The priority can be optionally specified by appending a : followed by the value. The default priority is 4, unless class is idle, then priority will always be 7. The currently supported values for class are idle, best−effort and real−time.

−k, −−umask mask

This sets the umask of the process before starting it (since version 1.13.22).

−m, −−make−pidfile

Used when starting a program that does not create its own pid file. This option will make start−stop−daemon create the file referenced with −−pidfile and place the pid into it just before executing the process. Note, the file will only be removed when stopping the program if −−remove−pidfile is used. Note: This feature may not work in all cases. Most notably when the program being executed forks from its main process. Because of this, it is usually only useful when combined with the −−background option.

−−remove−pidfile

Used when stopping a program that does not remove its own pid file (since version 1.17.19). This option will make start−stop−daemon remove the file referenced with −−pidfile after terminating the process.

−v, −−verbose 詳 細 な 情 報 を 出 力 す る 。

終 了 ス テ ー タ ス

0 指 定 さ れ た ア ク シ ョ ン が 実 行 さ れ た 。

−−oknodo が 指 定 さ れ た 場 合 、 何

も 行 わ れ な か っ た 場 合 も 意 味 す る 。 こ れ は 、 −−start が 指 定 さ れ た が マ ッ チ す る プ ロ セ ス が 実 行 さ れ て い た 場 合 、 −−stop が 指 定 さ れ た が マ ッ チ す る プ ロ セ ス が 存 在 し な か っ た 場 合 に 発 生 し う る 。

1

−−oknodo が 指 定 さ れ な か っ た 場 合 に 、 何 も 行 わ れ な か っ た 。

2

−−stop お よ び −−retry が 指 定 さ れ た が 、 規 定 時 間 の 最 後 ま で 到 達 し た に も 関 わ ら ず 、 プ ロ セ ス が ま だ 実 行 さ れ て い る 。

3

そ の 他 の エ ラ ー 。

−−status コ マ ン ド を 実 行 し た 際 に は 、 以 下 の 戻 り 値 が 返 さ れ る :

0 プ ロ グ ラ ム は 実 行 中 で あ る 。

1 プ ロ グ ラ ム は 実 行 中 で な い が 、

pid フ ァ イ ル が 存 在 し て い る 。

3 プ ロ グ ラ ム は 実 行 中 で な い 。

4 プ ロ グ ラ ム の 状 況 を 確 認 で き な

い 。

既 に 実 行 中 で な い 場 合 に 、 food デ ー モ ン を (プ ロ セ ス 名 food、 実 行 ユ ー ザ food 、 PID 情 報 を food.pid に 格 納 で ) 起 動 す る 。

start−stop−daemon −−start −−oknodo −−user food −−name food \

−−pidfile /run/food.pid −−startas /usr/sbin/food \

−−chuid food −− −−daemon

foodSIGTERM を 送 信 し 、 停 止 す る ま で 5 秒 間 待 機 す る :

start−stop−daemon −−stop −−oknodo −−user food −−name food \

−−pidfile /run/food.pid −−retry 5

food 停 止 の た め の カ ス タ ム ス ケ ジ ュ ー ル の デ モ :

start−stop−daemon −−stop −−oknodo −−user food −−name food \

−−pidfile /run/food.pid −−retry=TERM/30/KILL/5

翻 訳 者

高 橋 基 信 <monyo [AT] monyo.com>. 喜 瀬 浩 <kise [AT] fuyuneko.jp>. 関 戸 幸 一 <sekido [AT] mbox.jp>. 鍋 谷 栄 展 <nabe [AT] debian.jp>. 倉 澤 望 <nabetaro [AT] debian.jp>. 石 川 睦 <ishikawa [AT] linux.jp>. 鵜 飼 文 敏 <ukai [AT] debian.jp>. 中 野 武 雄 <nakano [AT] apm.jp>.

翻 訳 校 正

Debian JP Documentation ML <debian-doc [AT] debian.jp>.