Questions tagged [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.

105 questions
226
votes
16 answers

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. Would I also need a loop that never…
adhanlon
  • 6,407
  • 13
  • 43
  • 41
78
votes
5 answers

Run bash script as daemon

I have a script, which runs my PHP script each X times: #!/bin/bash while true; do /usr/bin/php -f ./my-script.php echo "Waiting..." sleep 3 done How can I start it as daemon?
Sergey B.
  • 969
  • 1
  • 7
  • 12
16
votes
3 answers

Can I have some code constantly run inside Django like a daemon

I'm using mod_wsgi to serve a django site through Apache. I also have some Python code that runs as a background process (dameon?). It keeps polling a server and inserts data into one of the Django models. This works fine but can I have this code be…
Mridang Agarwalla
  • 43,201
  • 71
  • 221
  • 382
12
votes
1 answer

How can I create .sh extension file in Linux Ubuntu?

I'm trying to write a script to run one of my .jar files as daemons, but I am not understanding how to create a .sh extension file in Ubuntu. I have already used vi to create a file with the code that I want, but I cannot figure out how to define…
vikas
  • 471
  • 3
  • 15
  • 31
9
votes
1 answer

Correct daemon behaviour (from PEP 3143) explained

I have some tasks [for my RPi] in Python that involve a lot of sleeping: do something that takes a second or two or three, then go wait for several minutes or hours. I want to pass control back to the OS (Linux) in that sleep time. For this, I…
RolfBly
  • 3,612
  • 5
  • 32
  • 46
8
votes
2 answers

Bad File Descriptor in Ruby Daemons

Using Ruby v1.8.7 and Daemons v1.1.8 on Mac OS X Lion, I am attempting to write a consumer process and get it run as a dameon: # config[:name] => 'idx_my_delete_consumer' # config[:daemon] => {:multiple => false, # :backtrace =>…
pr4n
  • 2,918
  • 3
  • 30
  • 42
7
votes
2 answers

Ruby: Logger and Daemons

i'm using ruby 1.9.2p180 (2011-02-18 revision 30909) in Order to do the logging i use the logging gem. My program has two blocks, which are used as daemons. But logging from these blocks results in an error and nothing is written to the logfile: log…
Dakkar
  • 5,682
  • 5
  • 22
  • 28
6
votes
1 answer

Ruby Daemons log rotation

When I'm setting logging parameters to the Daemons (1.1.0) gem, how would I achieve similar behavior to this line? logger = Logger.new('foo.log', 10, 1024000) Daemon options: options = { :ARGV => ['start'], :dir_mode =>…
Tommy
  • 1,809
  • 2
  • 13
  • 13
6
votes
1 answer

Ruby daemons - what is a monitor and how does it work?

So Ruby's daemons gem lets you set monitor=true when you start up your process. What the heck is a monitor and what do you do with it? All you do is specify true or false...is that creating a log file somewhere? Something that is actually monitoring…
Rob Cameron
  • 9,674
  • 7
  • 39
  • 42
5
votes
5 answers

What is the preferred way to write my linux daemons?

Hello to All I have a PHP website that should use some cached data (stored in Memcache, for example). The data should be stored in cache by daemons fetching it from web services and some of it should be stored in MySQL server too. The daemons…
Yossi
  • 539
  • 9
  • 20
5
votes
0 answers

heartbeat timeout error running rabbitmq

Running a Rails App in Mac. I start rabbit mq server in other terminal tab: $ rabbitmq-server The I do staff within my Web App, and when the mail is supossed to be sent, I got this in /usr/local/var/log/rabbitmq/rabbit@localhost-sasl.log =INFO…
Emba Moussa
  • 662
  • 8
  • 18
5
votes
3 answers

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…
Patrick O'Doherty
  • 1,642
  • 2
  • 14
  • 20
5
votes
1 answer

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…
jsharpe
  • 2,546
  • 3
  • 26
  • 42
5
votes
1 answer

How to kill all processes inside ruby Thor on stop?

I have a script below using Thor to run like a rake task managing ARGV. #!/usr/bin/env ruby require "thor" class Run < Thor desc "start", "start script" def start p1 = fork{ loop... } p2 = fork{ loop... } # 3 processes…
Luccas
  • 4,078
  • 6
  • 42
  • 72
5
votes
2 answers

Connect two daemons in python

What is the best way to connect two daemons in Python? I have daemon A and B. I'd like to receive data generated by B in A's module (maybe bidirectional). Both daemons support plugins, so I'd like to shut communication in plugins. What's the best…
Simon
  • 2,329
  • 4
  • 30
  • 49
1
2 3 4 5 6 7