简体   繁体   English

运行bundle exec时,如何使bundler在“ ps aux”中显示完整命令?

[英]How to get bundler to show the full command in “ps aux” when running bundle exec?

I have a couple of rake tasks that I need to run in background. 我有一些需要在后台运行的瑞克任务。 I'm using rbenv to manage my ruby versions, supervisord to run the tasks, and bundle to make sure I use the correct gems versions. 我正在使用rbenv来管理我的ruby版本, supervisord来运行任务,并bundle以确保使用正确的gems版本。 My supervisord config for each task looks like this: 我对每个任务的监督配置如下所示:

[program:data-importer]
command=/home/ubuntu/.rbenv/bin/rbenv exec bundle exec rake import:data
environment=RAILS_ENV=production,PATH=/home/ubuntu/.rbenv/shims:%(ENV_PATH)s,PRODUCTION=true
directory=/home/ubuntu/app/current
user=ubuntu
stdout_logfile=/var/log/app/%(program_name)s-out.log
stderr_logfile=/var/log/app/%(program_name)s-err.log
autostart=true

I'm also using consul to monitor my infrastructure, and I'm using a consul check to make sure that these scripts are running. 我还使用consul来监视我的基础结构,并且使用领事检查来确保这些脚本正在运行。 The check calls a very simple bash script, shown below: 该检查调用了一个非常简单的bash脚本,如下所示:

#!/bin/bash

if ps -ef | grep [i]mport:data | grep -v running; then
  echo "data importer running"
  exit 0
else
  echo "data importer not running"
  exit 2
fi

These scripts were running just fine until a couple of days ago, when these checks started to fail. 这些脚本运行良好,直到几天前这些检查开始失败。 The problem is that when I run ps -ef , the process listed doesn't contain import:data anymore. 问题是当我运行ps -ef ,列出的进程不再包含import:data了。 It now shows this: 现在显示如下:

ubuntu 30450 ... /home/ubuntu/.rbenv/versions/2.3.1/bin/rake

Nothing really changed on the machine, only the Ruby version. 在机器上并没有真正改变,只有Ruby版本。 We used 2.2.2, and we upgraded to 2.3.1 last Friday. 我们使用2.2.2,并在上周五升级到2.3.1。 That's why I think it's a bundler issue, as we installed a newer version after the ruby upgrade. 这就是为什么我认为这是捆绑软件的问题,因为在ruby升级之后我们安装了更新的版本。

We didn't see the problem until Sunday, but it could be that we just didn't see it before. 直到周日,我们才发现问题,但有可能是我们之前没有发现问题。

Can anyone help me with this? 谁能帮我这个? I've been stuck for a while now :( 我已经被卡住了一段时间了:(

要在ps -ef中获得所需的输出,您必须在rake调用周围加上引号:

bundle exec 'rake import:data'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM