daemons

Redirect the "puts" command output to a log file

Hi, I am working on creating a daemon in Ruby using the daemons gem. I want to add output from the daemon into a log file. So I am wondering what is the easiest way to redirect puts from the console to a log file? ...

problem with daemons gem in rails

Hello, 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 (but not certainly) the exception that made the application exit abnormally *** #<...

What's the best option for a framework-agnostic Ruby background worker library?

I'm building a simple recipe search engine with Ruby and Sinatra for an iPhone app, using RabbitMQ for my message queue. I'm looking around and finding a lot of different implementation choices for background processes, but most of them either implement custom message queue algorithms or operate as Rails plugins. What's out there in te...

Streaming, Daemons, Cronjobs, how do you use them? (in Ruby)

Hey there, I've finally had a second to look into streaming, daemons, and cron tasks and all the neat gems built around them! But I'm not clear on how/when to use these things. I have a few questions: 1) If I wanted to have a website that stayed constantly updated, realtime, with my Facebook friends' activity feeds, up-to-the-minute ...

How to specify daemon's log and pid directories?

Using Daemons, how do I specify that my script's log goes in /log/ and its pid goes in /tmp/pids/? I've read the docs, and I see :dir/:dir_mode, but I can only make it do one or the other, not both -- seems like a really bad set of options if you ask me. ...

problem handling db conection on daemonize threads...

Just for the record, i just started programing on python, and this is the first time i try to do a daemon. I have a problem handling DB connections in a daemon i've been working on, the first thing i do, is connect to my postgres db with: try: psycopg2.apilevel = '2.0' psycopg2.threadsafety = 3 cnx = psycopg2.connect( "host='192....

How to make a python script run like a service or daemon in linux

I have written a python script that checks a certain e-mail address and passes new e-mails to an external program. How can I get this script to execute 24/7, such as turning it into daemon or service in linux. Anyone that answers this, would I also need a loop that never ends in the program, or can it be done by just having the code re...

Ruby Daemons causing ActiveRecord logger IOError

I'm writing a project at the moment in Ruby which makes use of the ActiveRecord gem for database interaction and I'm trying to log all the database activity using the ActiveRecord::Base.logger attribute with the following code ActiveRecord::Base.logger = Logger.new(File.open('logs/database.log', 'a')) This works fine for migrations et...

Ruby Daemons Gem

Hello there, I installed the ruby gem Daemons. To make sure it was working I created a script that would print to a file every 5 seconds. I then created another file to run the script using the trivial example they give you in the readme located at http://daemons.rubyforge.org/ . I require both rubygems and daemons. Then I type 'rub...

delayed_job: detecting when one instance already running in /etc/init.d/delayed_job

Hi all I've been trying to build a robust /etc/init.d/delayed_job script. Below is my naive attempt which is failing in the case of the daemon already running. #! /bin/sh ... # return 1 if already running do_start() { /path/to/current/script/delayed_job start if [ "$?" -ne "0" ]; then echo "delayed_job i...

Timed server events with ruby on rails

I am attempting to create a web-based game in Ruby on Rails. I have a model named 'Game', which has a datetime in the database entry that corresponds to a time that I would like the server to call the Game model's update_game function. Depending on the game's settings, this could be every 30 seconds to every 12 hours. Ruby on Rails ...

Ruby/Rails: 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. Basically, from the rails stack, i only need AR (or an ORM). The found solutions/approaches for t...

Process.daemon vs. running a Ruby script with nohup + &

I have a Ruby 1.9 script that I want to run as a long-running background process. It looks like I have a choice between calling Process.daemon inside the script to daemonize it, or I can just run the script in the background using a shell's ampersand and keep it running after I log out of the server by prefixing the command with nohup....

Monitoring/Managing processes,deamons,threads

My problem domain is to monitor/manage, processes, threads, daemons, on a remote machine. I have not choosen a language as yet to write the tool. I am open to suggestions. Clarification: 1) By Monitoring I mean "knowing current running state, memory usage, process usage ". 2) Would prefer very little setup requirements imposed. Assumpt...

How to make/monitor/deploy daemon processes in JRuby

I'm currently porting a Rails App currently using REE to JRuby so I can offer an easy-to-install JRuby alternative. I've bundled the app into a WAR file using Bundler which I'm currently deploying to GlassFish. However, this app has a couple of daemon processes and it would be ideal if these could be part of the WAR file, and potentiall...

daemon spawn : gem_original_require : no such file to load --daemon-spawn (Load Error)

I am trying to run daemon process using daemon-spawn gem. Here is the code for delayed_delta daemon process #file - script/dj #!/usr/bin/env ruby # -*- ruby -*- require 'rubygems' require 'daemon-spawn' RAILS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) class DelayedJobWorker ENV['MIN_PRIORITY'], :max_prior...

starting and stopping a daemon at user login logout

I have a daemon script written in ruby which responds to commands like daemon start and daemon stop. It's executable with shebang #!/usr/bin/env ruby and it works invoked from terminal. I need to start the daemon on login and stop it on logout. Background info: KDE, zsh. I already tried to make two separate shell scripts with daemon st...

iOS daemons. are they legal for AppStore?

Hello. Can't find out if daemon application can be run on non-jailbroken iPhone. And what is Apple policy about this stuff? I don't really know if my idea is possible at all... I wonder if it's possible to create such a daemon that can intercept outcoming user call and play custom tone signal while remote user does not answer our call. A...

Can't Run Delayed Job in the background on ruby 1.9.2

rake jobs:work works just fine But RAILS_ENV=development ./script/delayed_job start (or any of its permutations) doesn't work on 1.9.2. I can run it just fine on 1.9.1. Anyone have a solution for this? ...