daemon

Why does my Python daemon hog all my CPU while sleeping?

I'm using this recipe: http://code.activestate.com/recipes/278731/ on an Ubuntu server. I make a daemon instance like this: class MyDaemon(Daemon): def run(self): while True: try: do_my_data_processing() except MySQLdb.OperationalError: # Sleep an extra 30 second...

How to mimic DropBox functionality with Ruby script?

I would like to upload documents to GoogleDocs every time the OS hears that a file was added/dragged/saved in a designated folder, just the way DropBox uploads a file when you save it in the DropBox folder. What would this take in Ruby, what are the parts? How do you listen for when a File is Saved? How do you listen for when a File i...

Multiple programs using the same UDP port? Possible?

I currently have a small Python script that I'm using to spawn multiple executables, (voice chat servers), and in the next version of the software, the servers have the ability to receive heartbeat signals on the UDP port. (There will be possibly thousands of servers on one machine, ranging from ports 7878 and up) My problem is that the...

How to use the cachegrind output to optimize the application

I need to improve the throughput of the system. The usual cycle of optimization has been done and we have already achieved 1.5X better throughput. I am now beginning to wonder if I can utilize the cachegrind output to improve the system's throughput. Can somebody point me to how to begin on this? What I understand is we need to ensur...

How can a Perl CGI script communicate with a daemon on the webserver?

I am building a Web interface to monitor an embedded system. I have built a Perl script which runs remote commands and gathers output from that system. Now what I need is a Web interface which makes calls to this script (executes remotes command) and displays data on the web page. First of all, I need to make my script as a daemon proc...

Windows SMTP server for email api

Hi, I'm architecting a web service where users can update, for example, a blog by sending an email. What's a good email server for Windows for this? Any other advice / examples appreciated! Thanks, Jason ...

Create a daemon with double-fork in Ruby

What is the proper way to create a well-behaved Unix or Linux daemon in Ruby? What is the definition of a well-behaved daemon anyway, and how would one write such a program in Ruby? ...

How to IPC between PHP clients and a C Daemon Server?

Hi all, and thanks for taking a look at the question. The background I have several machines that continuously spawn multiple (up to 300) PHP console scripts in a very short time frame. These scripts run quickly (less than a second) and then exit. All of these scripts need read only access to a large trie structure which would be very e...

Load Ruby on Rails models without loading the entire framework

I'm looking to create a custom daemon that will run various database tasks such as delaying mailings and user notifications (each notice is a separate row in the notifications table). I don't want to use script/runner or rake to do these tasks because it is possible that some of the tasks only require the create of one or two database ro...

Seriously speeding up PHP?

I've been writing PHP for years, and have used every framework under the sun, but one thing has always bugged me... and that's that the whole bloody thing has to be interpreted and executed every time someone tells my server they want the page served. I've experimented with caching, FastCGI, the Zend Job Queue (and symfony plug-ins that...

Linux Daemon written in Java location

I'm currently writing a Java daemon. I'm writing a script that will have the standard daemon commands (start, stop, restart, status) and I'm trying to decide on where things should go when installing the daemon. My current idea is: PID File: /var/run/myapp.pid Daemon Script: /etc/init.d/myapp Java App (.jar): /usr/bin/myapp Logs: /var/l...

Organizing logs with log4j

Hey all, I'm currently working on a Linux daemon written in Java. What is the common naming scheme for logs? Right now I'm thinking of doing something like: DEBUG = /var/log/myapp.debug INFO = /var/log/myapp.info WARN = /var/log/myapp.warn ERROR = /var/log/myapp.err FATAL = /var/log/myapp.err Does anyone have any opinions / suggestio...

What and how much overheads happen when I use a Reference class?

I saw there is a daemon thread running whenever we create a referenced object using any Reference class like WeakReference, FinalReference, SoftReference, PhantomReference, Referemce And if we have hierarchal thread structure then at each level there is an extra daemon thread initiated. ...

Writing daemon in objective c

I need to write a daemon, much like windows service on os x using objective c. Can anyone point to some sample? or guide me about how to do this? ...

Writing daemon in objective c

I need to write a daemon, much like windows service on os x using objective c. Can anyone point to some sample? or guide me about how to do this? ...

Check if key is pressed using python (a daemon in the background)

I've created a python script in which an event needs to be executed each time I press the Super (or WinKey) on my keyboard. How can one achieve this without the python process being "focused" - as it is running in the background waiting for the key to be pressed to execute the event? I've seen a lot of posts around the web showing me h...

Java daemon - handling shutdown requests

I'm currently working on a daemon that will be doing A LOT of different tasks. It's multi threaded and is being built to handle almost any kind of internal-error without crashing. Well I'm getting to the point of handling a shutdown request and I'm not sure how I should go about doing it. I have a shutdown hook setup, and when it's call...

How to load system-wide daemons on MacOS

I'm trying to load my daemon-app with this command launchctl load /Library/LaunchDaemons/myPlistFileName It works fine, but only while my user is logged in on system. How can i load my deamon-app, which will stay loaded without any user logged into the system (like the windows-services)?? The command sudo launchctl load /Library/Launch...

Managing Signal Handling for daemons that fork()

I want to write a robust daemon in perl that will run on Linux and am following the template described in this excellent answer. However there are a few differences in my situation: First I am using Parallel::ForkManager start() and next; to fork on an event immediately followed by exec('handle_event.pl') In such a situation, I have the...

Kill all delayed_job workers

I use delayed_job as a daemon http://wiki.github.com/tobi/delayed%5Fjob/running-delayedworker-as-a-daemon. I can't tell why, but sometimes I see more than one job done by several workers (different pids), and running stop doesn't stop anything. is there a way to kill all daemons of this proc/all workers? Or kill a specific pid (I'm on a...