Tag: nohup

Monit捆绑exec rails s

我有以下shell脚本,允许我启动我的rails应用程序,让我们说它叫做start-app.sh : #!/bin/bash cd /var/www/project/current . /home/user/.rvm/environments/ruby-2.3.3 RAILS_SERVE_STATIC_FILES=true RAILS_ENV=production nohup bundle exec rails s -e production -p 4445 > /var/www/project/log/production.log 2>&1 & 上面的文件具有以下权限: -rwxr-xr-x 1 user user 410 Mar 21 10:00 start-app.sh* 如果我想检查过程,我会执行以下操作: ps aux | grep -v grep | grep “:4445” 它会给我以下输出: user 2960 0.0 7.0 975160 144408 ? Sl 10:37 0:07 puma 3.12.0 […]

使用Capistrano开始后台任务

对于我的RubyOnRails-App,我必须在Capistrano部署结束时开始后台工作。 为此,我在deploy.rb中尝试了以下内容: run “nohup #{current_path}/script/runner -e production ‘Scheduler.start’ &”, :pty => true 有时它可以工作,但大多数情况下它不会启动过程(=未在ps -aux中列出)。 并且没有错误消息。 没有nohup.out,不在主目录中,也不在rails app目录中。 我尝试在scheduler.rb中使用trap(’SIGHUP’,’IGNORE’)而不是nohup,但结果是一样的。 让它工作的唯一方法是删除“:pty => true”并在“cap deploy”结束时执行手动Ctrl-C。 但我不喜欢这个…… 还有其他机会调用此Scheduler.start吗? 或者获取更多错误消息? 我在服务器上使用Rails 2.3.2,Capistrano 2.5.8,Ubuntu Hardy