LoginSignup
5
2

More than 5 years have passed since last update.

sshを切っても動くデーモンをnohupで簡単につくる

Last updated at Posted at 2017-08-15

nohupというunixコマンドを使えば、ssh接続を切った時に発生するHUPをトリガーにprocessがkillされることを防げる。

基本的な使い方

&を使ってバックグラウンド実行させる

(ssh)$ nohup [command] > log.txt &
(ssh)$ exit

ログをとらない時

入力と出力を明記する

(ssh)$ nohup [command] < /dev/null 2>&1 /dev/null &
(ssh)$ exit

入力: < /dev/null (null。つまり何もなし)
出力:2>&1 /dev/null (標準出力、標準エラー出力共にnullに。つまり何もなし)

5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2