How to close Rserve from the command line

倾然丶 夕夏残阳落幕 提交于 2019-12-23 09:17:08

问题


this question relates to close connection and perhaps also to this close Rserve. However, in the later case there are connections open and in the first case the answer does not specify how to "kill" the server.

It is important to say that I am new to Rserve, and I have used it for the 1st time today for some mild R-python interaction. I started Rserve from the command line as:

% R CMD RServe

I though I had closed the connection after the session, but when I now try to re-start Rserve again with a new configuration I get the error:

% ##> SOCK_ERROR: bind error #48(address already in use)

which is pretty clear. Moreover ps ax | grep Rserve returns:

% ps ax | grep Rserve
18177   ??  Ss     0:00.33 /Library/Frameworks/R.framework/Resources/bin/Rserve
18634 s006  U+     0:00.00 grep Rserve 

which I understand that indeed means that the server is running. I have tried a few things:

% R CMD RSclose
 /Library/Frameworks/R.framework/Resources/bin/Rcmd: line 62: exec: RSclose: not found

% R CMD RSshutdown
 /Library/Frameworks/R.framework/Resources/bin/Rcmd: line 62: exec: RSshutdown: not found

and finally

% R CMD shutdown
 shutdown: NOT super-user

I am wondering, should I then run:

% sudo R CMD shutdown

(I would like to make sure before running that command, in case I screw something)

Anyway, the question would be very simple. How can I close server to re-run it.

Thanks in advance for your time!


回答1:


You are confused:

 R CMD something

will always go to R. And R no longer knows Rserve is running even though you may have started it via R CMD Rserve: these are now distinct processes.

What you should do is

 kill 18177       # or possibly  kill -9 18177

and there are wrappers to kill which first grep for the name and find the PID for you:

 killall Rserve   # or possibly  killall -9 Rserve

The -9 sends a higher-order SIGKILL (ie 'really go and die now') intensity than the default of -15 for SIGTERM) (ie 'please stop now').



来源:https://stackoverflow.com/questions/30052985/how-to-close-rserve-from-the-command-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!