1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VPSサーバ(ubuntu20.04)上で、ログアウトしてもコマンドをバックグランドで動作し続けておきたい

Posted at

VPSサーバ(ubuntu20.04)上で、ログアウトしてもコマンドをバックグランドで動作し続けておきたい時の備忘メモ

通常、コマンドをバックグランドで動作させた場合はコマンドの後ろに'&'を付ける

bash polling.sh &

しかしこれだと、ログアウト時に処理が終了してしまう

exit

これを回避するにはnohupコマンドを使えばOK

【 nohup 】コマンド――端末を閉じてもログアウトしても処理を続ける

nohup bash polling.sh &

これでVPSからログアウトしてもコマンドがバックグランドで動作し続けてくれる

参考

【 nohup 】コマンド――端末を閉じてもログアウトしても処理を続ける

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?