如何从命令行关闭Rserve [英] How to close Rserve from the command line

查看:257
本文介绍了如何从命令行关闭Rserve的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题与紧密连接有关,也许也与此有关关闭Rserve .但是,在后一种情况下,有打开的连接,在第一种情况下,答案没有指定如何杀死"服务器.

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.

重要的是要说我是Rserve的新手,而今天我第一次使用它进行一些温和的R-python交互.我从命令行以以下方式启动Rserve:

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

虽然我在会话后关闭了连接,但是当我现在尝试使用新配置再次重新启动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)

这很清楚.而且ps ax | grep Rserve返回:

% 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

最后

% 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.

提前感谢您的时间!

推荐答案

您很困惑:

 R CMD something

将始终转到R.并且R不再知道Rserve正在运行,即使您可能是通过R CMD Rserve启动的:这些现在是不同的进程.

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.

您应该做的是

 kill 18177       # or possibly  kill -9 18177

并且有kill的包装器,该包装器首先使用grep输入名称,然后为您找到PID:

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

SIGTERM的默认值-15(即请立即停止")相比,-9发送的强度更高的SIGKILL(即现在真的要死了")强度更高.

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').

这篇关于如何从命令行关闭Rserve的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆