バックグラウンドで、コマンドを実行する | Cent os 5

&を付けるのだと駄目なんですね。

実行して、ctrl+zで止めてからbgで実行しました。

$ /tmp/aput.php 2>&1 > /tmp/aput.log
Ctrl+Z で中断
[1]   終了しました      /tmp/aput.php 2>&1 > /tmp/aput.log

[2]+  Stopped                 /tmp/aput.php 2>&1 > /tmp/aput.log
$ bg %2
[2]+ /tmp/aput.php 2>&1 > /tmp/aput.log &
$ jobs
[2]+  Running                 /tmp/aput.php 2>&1 > /tmp/aput.log &

実行中のものを止めたいときは、強制終了で。

$ jobs -pl
[2]+ 12513 Running                 /tmp/aput.php 2>&1 > /tmp/aput.log &
$ kill -9 12513
$ jobs
[2]+  強制終了            /tmp/aput.php 2>&1 > /tmp/aput.log

stopped状態のものはこんな感じで。

$ /tmp/aput.php 2>&1 > /tmp/aput.log &
[1] 12490
$

[1]+  Stopped                 /tmp/aput.php 2>&1 > /tmp/aput.log
$ jobs
[1]+  Stopped                 /tmp/aput.php 2>&1 > /tmp/aput.log
$ kill %1
$ jobs
[1]+  終了しました      /tmp/aput.php 2>&1 > /tmp/aput.log

This entry was posted on 月曜日, 5月 9th, 2011 at 2:47 AM and is filed under blog, server. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Unityによるゲームを公開しております iOS/Android
https://itunes.apple.com/jp/app/lost-knight-3d-action/id900917032
https://play.google.com/store/apps/details?id=com.groundroad.runknight

各種開発支援・機能開発等小さいお仕事などもお請けしております。
unity開発支援, PHPシステム開発, javascript/html5 フロント開発, titanium mobileアプリ開発
お気軽にお問い合わせください
大崎・五反田近郊での対面でのお打ち合わせはいつでも可能です。