Questions tagged [ruby-daemons]

Daemons provides an easy way to wrap existing ruby scripts (for example a self-written server) to be run as a daemon and to be controlled by simple start/stop/restart commands.

Daemons provides an easy way to wrap existing ruby scripts (for example a self-written server) to be run as a daemon and to be controlled by simple start/stop/restart commands.

You can also call blocks as daemons and control them from the parent or just daemonize the current process. Besides this basic functionality, daemons offers many advanced features like exception backtracing and logging (in case your ruby script crashes) and monitoring and automatic restarting of your processes if they crash.

Daemon-kit aims to simplify creating Ruby daemons by providing a sound application skeleton (through a generator), task specific generators (jabber bot, etc) and robust environment management code.

Find more info about projects and plug-ins for daemonizing in Ruby here

18 questions
4
votes
2 answers

Ruby's `.present?` without Rails?

I'm developing a "Rails-less" Ruby daemon for automation (although in theory it runs within a Rails directory). For general purposes and the principle of the matter, I would like to find the (most) "native"/common way to utilize a Ruby version of…
Jon Lawton
  • 890
  • 3
  • 14
  • 33
2
votes
1 answer

How do I create a daemon to run an SMTP server within a Rails stack?

I'm running a rails app which, amongst other things, needs to role it's own SMTP server. Mini-SMTP-Server looks very good, but I don't know how to get it to run as a daemon. I'd like to be able to act on incoming messages and I need to have the full…
Simmo
  • 1,717
  • 19
  • 37
1
vote
1 answer

Ruby How to create daemon process that will spawn multiple workers

I have a script called 'worker.rb'. When ran this script will perform processing for a while (an hour lets say) and then die. I need to have another script which is going to be responsible for spawning the worker script above. Let's call this script…
user1032752
  • 751
  • 1
  • 11
  • 28
1
vote
1 answer

How to daemonize Sidekiq workers in Heroku?

The sidekiq workers get terminated in Heroku very frequently. It should be started every time. How can we make these workers to run without getting terminated in Heroku? Do we have any configurations for Sidekiq or Heroku / can we daemonize the…
1
vote
0 answers

Ruby daemon for Rails 3.2.12 app was not loaded - File path issue

We are using a script (ruote_daemon_starter) in a rails 3.2.12 engine (commonx) under "config/initializers" folder. This script is meant to call another script in the same engine under "/script" folder to start a daemon. Please see below details on…
user938363
  • 9,990
  • 38
  • 137
  • 303
1
vote
1 answer

Rufus scheduler and daemon script is not working in rails

I was making a script that runs periodically to make some code inside my rails app using rufus scheduler (I used it with daemon specifically to work on production server). But it is not working at all as it terminates and kill the process. Here is…
Shimaa Marzouk
  • 429
  • 4
  • 10
0
votes
1 answer

Running rake task from a daemon

I have a daemon that i made using the daemons gem I run it and it just closes without error, but the script doesn't seem to be actually running. I'm running a rake task from it, will daemons run the commands inside from the directory it was called…
Joseph Le Brech
  • 6,541
  • 11
  • 49
  • 84
0
votes
1 answer

Issue with daemons gem in Rails

I'm using daemons gem with Rails in addition to daemon_generator plugin. I'm getting this output in the daemons log file: Logfile created on Sat May 09 20:10:35 -0700 2009 by / -below you find the most recent exception thrown, this will be likely…
Tam
  • 11,872
  • 19
  • 69
  • 119
0
votes
1 answer

Where are logs for Daemons of my ruby script

I have demamonized my ruby script like this Daemons.run('script/meeting_receiver.rb') basically i am using gem https://github.com/thuehlinger/daemons. And i have used puts statements in my ruby code. So i was wondering where exactly i can find…
Zia Qamar
  • 1,694
  • 1
  • 15
  • 35
0
votes
1 answer

Authlogic & delayed_job & delayed_jobl_mailer & daemons?

[edit] I can delay all mail using delayed_job plugin on a shared server with a daemon… except the mail using authlogic. I don't know where I have to search, and why it is working in other way. daemons (off) delayed_job & delayed_mail_mailer (on)…
0
votes
2 answers

How get daemons' status programmatically using Ruby gem "daemons"

I have a script (myscript.rb) like below: require 'daemons' Daemons.run_proc 'myproc', dir_mode: :normal, dir: '/path/to/pids' do # Daemon code here... end So, I can check the daemon's status in console by ruby myscript.rb status. But I need to…
0
votes
1 answer

Ruby Process.daemon: turning on/off

I am trying to daemonize a Ruby script, running on 2.1.1. My daemon part of the code is like this: case ARGV[0] when "-start" puts "TweetSearcher started." Process.daemon when "-stop" Process.kill(9,Process.pid) else puts "Lacks arguments.…
sn0wtroopeer
  • 102
  • 2
  • 11
0
votes
0 answers

Daemon eats too much CPU when being idle

I am using blue-daemons fork of daemons gem (since the second one looks totally abandoned) along with daemons-rails gem, which wraps daemons for rails. The problem is that my daemon eats too much CPU when it's idle (10-20 times higher then it's…
Ilya Cherevkov
  • 1,743
  • 2
  • 17
  • 47
0
votes
2 answers

Build internal service, no http support needed

I need to build an internal service that queues the DB for changes (in one table) every one second, and processed data after this event. I do not need all the Rails stack since this service does not need the Controller/View functionality.…
Vlad Zloteanu
  • 8,464
  • 3
  • 41
  • 58
0
votes
1 answer

Why Ruby Daemons.run_proc block was skipped entirely on Ubuntu 12.04

We are trying to to start a daemon with gem daemons on Ubuntu 12.04 and Rails 3.2.12 environment for a ruote worker. Here is the daemon.rb (gem version 1.1.9): #!/usr/bin/env ruby require 'daemons' require 'logger' root = Dir.pwd …
user938363
  • 9,990
  • 38
  • 137
  • 303
1
2