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
4
votes
2 answers

Handling Input and Output of a Daemon

I want to create a daemon of a ruby program on Linux. I also want the daemon to be interactive-I want to be able to send input to the daemon through a file/pipe/the simplest method and receive output to a file. How do I go about doing this? I've…
Waley Chen
  • 929
  • 3
  • 10
  • 23
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
4
votes
0 answers

Unable to run a systemd service daemon on Ubuntu (how to switch to Upstart or is there an updated distro)

Note: I don't have any real experience managing servers or using Linux on any deep level so my knowledge and understanding is quite limited. In essence, I'm winging it. For full code examples see:…
Integralist
  • 2,161
  • 1
  • 32
  • 50
4
votes
2 answers

launchd doesn't launch my daemon

I'm trying to figuring out why my daemon doesn't be launched automatically (on Mac 10.8.3). However, it works well on other machines. Here is my plist under /Library/LaunchDaemons/
Kimi Wu
  • 309
  • 1
  • 4
  • 17
4
votes
3 answers

Running a PHP process as a daemon while safely killing it from background

We are running a PHP Daemon which look into a queue, receives worker jobs and spawns the worker to handle it. The workers themselves acquire a lock on a specific location before proceeding. We spawn the Daemon as nohup background processes. This…
Shreeni
  • 3,222
  • 7
  • 27
  • 39
4
votes
1 answer

How do I loop the restart of a daemon?

I am trying to use Ruby's daemon gem and loop the restart of a daemon that has its own loop. My code looks like this now: require 'daemons' while true listener = Daemons.call(:force => true) do users = accounts.get_updated_user_list …
DorkRawk
  • 732
  • 2
  • 6
  • 21
4
votes
1 answer

What doesn't work well with ProcessBuilder and Daemons

On the JavaDoc for ProcessBuilder it states The methods that create processes may not work well for special processes on certain native platforms, such as native windowing processes, daemon processes, Win16/DOS processes on Microsoft Windows,…
mrkaiser
  • 149
  • 7
4
votes
1 answer

ruby - can't write to logs in daemons

Normally I can write logs with Logger: //abc.rb require 'logger' logger = Logger.new('foo.log') $./abc.rb But in a Daemons I got a permission error: //xyz.rb require 'logger' require 'daemons' Daemons.run_proc('xyz') do logger =…
Lai Yu-Hsuan
  • 27,509
  • 28
  • 97
  • 164
3
votes
3 answers

Java wrapper as daemon

I am using this YAJSW to run Java Daemon on my Centos 5.5 machines. The think it runs well but out of suddent I notice I get this sort of error and then it just goes down. Any help what must I do to avoid this sort of problem? Can I use some…
user837306
  • 857
  • 3
  • 18
  • 32
3
votes
1 answer

Python: kill all processes of a pool

I have a function foo() that creates multiple objects. This function is called several times during the run of my progam. In order to speed up my code, I want to make foo() create a set of processes, that calculate the new objects in parallel. def…
Natjo
  • 2,005
  • 29
  • 75
3
votes
2 answers

celeryd and celerybeat pid files are not being created, workers are not starting, but output says OK

I setted up celeryd and celerybeat as daemons, and they worked until not too long. But since some time, it wont start workers and not create pid files. Here is my /etc/default/celeryd: # Name of nodes to start CELERYD_NODES="w1 w2 w3 w4 w5 w6 w7…
Throoze
  • 3,988
  • 8
  • 45
  • 67
3
votes
1 answer

Start/stop return code with Daemons Ruby gem

I've written some code that should run as a server and wrapped it with Daemons as Daemons.run('myserver.rb'). When I run it as ./daemon.rb start it works but it is not informative at all, i.e. if myserver.rb throws an exception I will not even know…
Andrii Yurchuk
  • 3,090
  • 6
  • 29
  • 40
3
votes
2 answers

Daemons do not get restarted?

I am trying to run the same script in multiple daemons. myapp.rb looks like this: loop do sleep 5 1 / 0 # crash it end my myapp_controller.rb: require 'rubygems' require 'daemons' options = { :log_output => true, :backtrace => true, …
akonsu
  • 28,824
  • 33
  • 119
  • 194
2
votes
2 answers

Passing arguments to a ruby script

I run a file like this: ruby hello.rb world.csv data.csv How would the start file look? I have this. require 'daemons' pwd = File.dirname(File.expand_path(__FILE__)) wFile = "#{pwd}/world.csv" dFile = "#{pwd}/data.csv" Daemons.run("hello.rb…
sunnyrjuneja
  • 6,033
  • 2
  • 32
  • 51
2
votes
0 answers

macOS daemon displays GUI?

To learn about macOS services (daemons and agents), I have a sample GUI app which counts every 10 sec in the background and displays some UI. In AppDelegate.swift class AppDelegate: NSObject, NSApplicationDelegate { static let TAG: String =…
NightFuryLxD
  • 847
  • 5
  • 15