Spring服务器:超时错误 [英] Spring server: Timeout error

查看:59
本文介绍了Spring服务器:超时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Rails schedule.rb文件运行cron任务。该任务将调用用ruby编写的函数。该功能运行良好。但是,当尝试作为cron运行时,出现此错误。

 使用`/home/ubuntu/.rvm/启动Spring服务器gems / ruby​​-2.4.0 / gems / spring-2.0.2 / bin / spring服务器--background在20秒后超时

Spring(2.0.2)已安装并正常运行。
知道如何解决这个问题吗?

解决方案

如果该命令在cron外部有效,但在crontab中无效,问题几乎可以肯定是该命令没有选择某些必要的环境变量设置。解决问题的方法有几种,但最简单也是最好的方法是将命令包装在shell脚本中



对于初始测试,您只需输入登录信息即可环境:

 。 〜/ .bash_profile 

但是最终,您只想设置所需的变量而不包含任何内容额外。有关更多信息,请参见定义自己的工作类型。 / p>

I am trying to run a cron-task using Rails schedule.rb file. The task invokes a function written in ruby. The function runs perfectly fine. However when trying to run as a cron I get this error.

Starting Spring server with `/home/ubuntu/.rvm/gems/ruby-2.4.0/gems/spring-2.0.2/bin/spring server --background` timed out after 20 seconds

Spring(2.0.2) is installed and working perfectly. Any idea how to solve this?

解决方案

If the command works outside of cron, but not in the crontab, the problem is almost certainly that the command isn't picking up some necessary environment variable setting. There are several ways to get around the problem, but the simplest and best is to wrap your command in a shell script.

For initial testing, you can simply source your login environment:

. ~/.bash_profile 

But eventually you'll want to just set the variables you need and not include anything extra. For more information, see Define your own job types.

这篇关于Spring服务器:超时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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