nginxを起動しようと思い、brew services start nginxとすると
==> Tapping homebrew/services Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'... remote: Enumerating objects: 1440, done. remote: Counting objects: 100% (319/319), done. remote: Compressing objects: 100% (233/233), done. remote: Total 1440 (delta 123), reused 245 (delta 80), pack-reused 1121 Receiving objects: 100% (1440/1440), 425.38 KiB | 1.42 MiB/s, done. Resolving deltas: 100% (599/599), done. Tapped 1 command (35 files, 525.2KB). ==> Successfully started `nginx` (label: homebrew.mxcl.nginx)
と表示されこの状態で
ps ax | grep nginxとすると
42526 ?? S 0:00.02 nginx: master process /usr/local/opt/nginx/bin/nginx -g daemon off; 42571 ?? S 0:00.00 nginx: worker process 42633 s000 R+ 0:00.00 grep nginx
となりました。この後にnginx -s stopを実行してps ax | grep nginxで確認すると
42883 s000 S+ 0:00.01 grep nginx
となり、ワーカープロセスとマスタープロセスが止まりました。
一方、次は別の方法で起動しようと思い、sudo nginxで起動してps ax | grep nginxを実行すると先ほどと同じように
45538 ?? Ss 0:00.00 nginx: master process nginx 45539 ?? S 0:00.00 nginx: worker process 45622 s000 S+ 0:00.01 grep nginx
となるのですがnginx -s stopを実行するとnginx: [alert] kill(45538, 15) failed (1: Operation not permitted)となるのですがなぜプロセスを止められないのでしょうか?また上記の二つの起動方法の違いはなんでしょうか?
やったこと
stopとkillの違いがよくわかりませんでしたが、エラーにkillという単語が出てきた上、killでプロセスを止めてる記事も多かったためkill -KILL 45538などしてみましたが今度はkill: kill 45538 failed: operation not permittedと言われてしまいました。
brew services start nginx で起動したら brew services stop nginx で止めると良いのでは。
また、brew では sudo しないのが一般的かと…。
ご回答いただきありがとうございます。 brew services stop nginx を実行した後、
Stopping `nginx`... (might take a while)
==> Successfully stopped `nginx` (label: homebrew.mxcl.nginx)
と表示されたのですが、続けてps ax | grep nginx で確認すると
45538 ?? Ss 0:00.00 nginx: master process nginx
45539 ?? S 0:00.00 nginx: worker process
49781 s000 R+ 0:00.01 grep nginx
と出力され、まだ残ってしまっているようなのですがどうしたらよろしいでしょうか?
回答1件
あなたの回答
tips
プレビュー