2012-07-05 74 views
4

我試着將信號發送給nginx。我試圖殺死所有的進程,但他們似乎只是回來。在Mac OS X Lion上一勞永逸停止nginx服務器

$ which nginx 
/opt/local/sbin/nginx 

$ sudo nginx -s stop 

$ sudo /opt/local/sbin/nginx -s stop 

$ ps -ef | grep nginx 
141: 0 24627  1 0 2:29PM ??   0:00.00 nginx: master process /opt/local/sbin/nginx 
142: -2 24628 24627 0 2:29PM ??   0:00.02 nginx: worker process 
143: -2 24629 24627 0 2:29PM ??   0:00.07 nginx: worker process 
144: -2 24630 24627 0 2:29PM ??   0:00.07 nginx: worker process 
145: -2 24631 24627 0 2:29PM ??   0:00.07 nginx: worker process 
146: -2 24632 24627 0 2:29PM ??   0:00.07 nginx: worker process 
147: -2 24633 24627 0 2:29PM ??   0:00.07 nginx: worker process 
148: -2 24634 24627 0 2:29PM ??   0:00.07 nginx: worker process 
149: -2 24635 24627 0 2:29PM ??   0:00.07 nginx: worker process 
150: -2 24636 24627 0 2:29PM ??   0:00.07 nginx: worker process 
151: -2 24637 24627 0 2:29PM ??   0:00.07 nginx: worker process 
167: 0 24924  1 0 2:36PM ??   0:00.01 /opt/local/bin/daemondo --label=nginx --start-cmd /opt/local/sbin/nginx ; --pid=fileauto --pidfile /opt/local/var/run/nginx/nginx.pid 
168: 0 24925 24924 0 2:36PM ??   0:00.00 (nginx) 
169: 0 24926  1 0 2:36PM ??   0:00.00 nginx: master process /opt/local/sbin/nginx 
170: -2 24927 24926 0 2:36PM ??   0:00.00 nginx: worker process 
171: -2 24928 24926 0 2:36PM ??   0:00.00 nginx: worker process 
172: -2 24929 24926 0 2:36PM ??   0:00.00 nginx: worker process 
173: -2 24930 24926 0 2:36PM ??   0:00.00 nginx: worker process 
174: -2 24931 24926 0 2:36PM ??   0:00.00 nginx: worker process 
175: -2 24932 24926 0 2:36PM ??   0:00.00 nginx: worker process 
176: -2 24933 24926 0 2:36PM ??   0:00.00 nginx: worker process 
177: -2 24934 24926 0 2:36PM ??   0:00.00 nginx: worker process 
178: -2 24935 24926 0 2:36PM ??   0:00.00 nginx: worker process 
179: -2 24936 24926 0 2:36PM ??   0:00.00 nginx: worker process 
205: 502 24939 24879 0 2:36PM ttys010 0:00.00 grep -n nginx 

我已經試過殺死那些進程,但他們只是再次出現。

我該如何終止nginx?

+2

你總得想,男人;) – Kristian 2012-07-05 21:40:00

回答

5

你得到回答,只是要清楚,也許幫助他人:

OS X應該重啓nginx的過程中爲你(運行它作爲一個系統服務,這是你最想要的什麼時間)。所以,你需要告訴launchd會停止管理這個過程中你的命令sudo launchctl unload <plist-filepath>,凡在我的情況是:

sudo launchctl unload /Library/LaunchDaemons/dev.nginx.plist

3

正在重新啓動nginx。

不幸的是沒有太多有關在線使用它的信息,我沒有安裝在這臺電腦上,但是daemondo --help應該提供一些關於如何停止它重新啓動的指示燈nginx

+0

謝謝你的提示!終於把它停下來了。必須運行'launchctl卸載' – user5243421 2012-07-05 22:12:08