daemon

How to Daemonize a Java Program?

I have a Java program that I'd like to daemonize on a linux system. In other words, I want to start running it in a shell and have it continue running after I've logged out. I also want to be able to stop the program cleanly. I found this article which uses a combination of shell scripting and Java code to do the trick. It looks good, b...

Good protocol for FAST inter-application communication?

I am about to implement a server application that can answer queries fast. The server is implemented in java. I don't want to waste a lot of time on a complicated communication protocol so I search for a good best-practice way of 1) performing a query to my server 2) letting the server answer that query Both the queries and answers w...

Detect stop with Ruby Daemons gem.

I'm using the ruby daemon gem. Wondering how I can add some extra steps to the stop action? Was hoping I could detect stop was called, and add some extra code to it. Anyone know how I can accomplish this? ...

Choosing and deploying a comet server.

I want to push data to the browser over HTTP without killing my django/python application. I decided to use a comet server, to proxy requests between my application and the client (though I still haven't really figured it out properly). I've looked into the following engines: orbited cometd ejabberd jetty Has anyone had any experience...

Long running java process

Hello. I have inherited a java system which should be run in the background on a Linux server. The directions call for it to be started java -jar start.jar. This seems a little too fragile for my liking. I'd like it to actually run in the background, ideally starting up automatically at boot time. What is the best way to achieve this? ...

Is it wise to use PHP for a daemon?

Hello all, I wish to create a background process and I have been told these are usually written in C or something of that sort. I have recently found out PHP can be used to create a daemon and I was hoping to get some advice if I should make use of PHP in this way. Here are my requirements for a daemon. Continuously check if a row ha...

Communicating with a running python daemon

I wrote a small Python application that runs as a daemon. It utilizes threading and queues. I'm looking for general approaches to altering this application so that I can communicate with it while it's running. Mostly I'd like to be able to monitor its health. In a nutshell, I'd like to be able to do something like this: python applic...

Rails Daemon stays in development mode

Hello! I have a Rails application with a daemon that checks a mailbox for any new emails. I am using the Fetcher plugin for this task. The daemon file looks like this: #!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/environment.rb' class MailFetcherDaemon < Daemon::Base @config = YAML.load_file("#{RAILS_ROOT}/config...

Redirecting standard output to syslog

Hi! I'm planning to package OpenTibia Server for Debian. One of the things I want to do is add startup via /etc/init.d and daemonization of the otserv process. Thing is, we should probably redirect output to syslog. This is usually done via the syslog() function. Currently, the code is swarmed with: std::cout << "Stuff to printout" <<...

Better script to restart mysql on Ubuntu 8.04

When I say sudo /etc/init.d/mysql restart on Ubuntu 8.04.2 sometimes there remains a "mysql_safe" process eating 99% of cpu. Making the machine practically inusable. Is there a better way to restart mysql? I thought about writing a script: sudo /etc/init.d/mysql stop sleep 10 sudo killall mysql_safe sudo /etc/init.d/mysql start But t...

Reference for proper handling of PID file on Unix

Where can I find a well-respected reference that details the proper handling of PID files on Unix? On Unix operating systems, it is common practice to “lock” a program (often a daemon) by use of a special lock file: the PID file. This is a file in a predictable location, often ‘/var/run/foo.pid’. The program is supposed to check when i...

PHP Daemon/worker environment

Problem: I want to implement several php-worker processes who are listening on a MQ-server queue for asynchronous jobs. The problem now is that simply running this processes as daemons on a server doesn't really give me any level of control over the instances (Load, Status, locked up)...except maybe for dumping ps -aux. Because of that I...

suggestions for a daemon that accepts zip files for processing

im looking to write a daemon that: reads a message from a queue (sqs, rabbit-mq, whatever ...) containing a path to a zip file updates a record in the database saying something like "this job is processing" reads the aforementioned archive's contents and inserts a row into a database w/ information culled from file meta data for each f...

How can I run a Perl script as a system daemon in linux?

What's a simple way to get a Perl script to run as a daemon in linux? Currently, this is on CentOS. I'd want it to start up with the system and shutdown with the system, so some /etc/rc.d/init.d integration would also be nice, but I could always add a custom line to /etc/rc.d/rc.local. ...

How to ensure that a program is running and restart it if needed ?

Hi, I developed a software (in C++) which needs to be continuously running. That basically means that it has to be restarted each time it stops. I was thinking about using cron jobs to check every minutes if it is still alive, but there might be a cleaner way or standard way of doing this. Thanks in advance ...

Ruby daemon hangs on rails load

I am having issues getting a workling daemon working correctly. When I run: ruby script/workling_client run the daemon starts to load rails, but hangs indefintely. When I kill the process, the stack trace is always the same: /Library/Ruby/Gems/1.8/gems/activesupport-2.1.2/lib/active_support/core_ext/load_error.rb:32:in `new': Interr...

Using execl to execute a daemon

I'm writing a program in C on Linux which includes a module that allows a shell command to be executed on a remote machine. The easiest way to actually execute the command would of course be to simply use the system() function, or use popen and then grab the output. However, I chose to use a more low-level approach due to other design...

Can I start a script so it's independent of its parent process on Linux?

Is there a way to start a script from another process, so that if the process dies/ends, the script still continues? Will setuid do this? If I were to set the owner to root, and then start the script? For example, if I have some PHP code starting a script, but httpd dies or gets killed, I think that it takes my script with it. Is the...

Running a threaded class as a deamon

I am writing a multi-threaded solution in Java to connect two systems, A & B. System A is completly serial, not threaded, and will supply data to send to system B. System B accepts data from multiple sources asynchronously all at the same time. I am using ThreadPoolExecutor to manage the threads. I am using a static singleton instanc...

Daemon python wrapper "subprocess I/O timed out", need some directions.

Hello, I am not very familiar with the way of creating a daemon in Python, therefore wheb trying to install and run a third party open source TeX Python Wrapper i got bite by an error i do nor really understand. I added some print to help debugging. The faulty one is called texdp.py When i run mathrand which calls texdp server start,...