daemon

Daemon writing output to file twice instead of once in C++.

I've written a daemon that writes the word "Beat" to a file, followed up the current date and time at 15 second intervals. However, each time I check the output file, the daemon appears to be outputting twice like this: Beat: Fri Jan 1 18:09:01 2010 Beat: Fri Jan 1 18:09:01 2010 where it should only have on entry. the entire...

Java daemon design practices

I'm writing a daemon in Java that takes in requests from multiple providers in which the provider would return a service object for the daemon to run as a thread. Application architecture: Main class Providers Services Libraries / Models List item Main class Basically loads the configuration file, initializes libraries required, etc...

Run php script as daemon process

I need to run a php script as daemon process (wait for instructions and do stuff). cron job will not do it for me because actions need to be taken as soon as instruction arrives. I know PHP is not really the best option for daemon processes due to memory management issues, but due to various reasons I have to use PHP in this case. I came...

How best to control (issue command signals to) a PHP-based Daemon script?

I've created a PHP Daemon script to continually monitor a particular directory on the server's file system for new files, and then process and archive them. Note: I'm using a php Daemon class provided at: http://www.phpclasses.org/browse/file/8958.html I've got the script running, but I need a way to interface with the daemon and issue...

Why can't I delete a file from a PHP daemon's child process?

I am building a simple PHP daemon script, using a php Daemon class provided at: http://www.phpclasses.org/browse/file/8958.html I'm stuck with this class for better or worse, and I don't have much time to get this done; so in order to issue custom commands to the daemon I'm just using a command file located in the /tmp directory. Howeve...

Python / Linux/ Daemon process trying to show gtk.messagedialog

Hi, on Ubuntu 8/9, i'm trying to write a daemon in python, that monitors a certain network condition and informs the user using a gtk.messagedialog. I installed this script using rc-update. The daemon starts at boot, but doesn't show the dialog even after I login. I assume because init.d starts my daemon at tty1 and no gnome is availabl...

How can I set up Celery to call a custom initialization function before running my tasks?

I have a Django project and I'm trying to use Celery to submit tasks for background processing ( http://ask.github.com/celery/introduction.html ). Celery integrates well with Django and I've been able to submit my custom tasks and get back results. The only problem is that I can't find a sane way of performing custom initialization in t...

Stop Erlang Daemon

Besides running $ killall -9 beam.smp, how can I kill an Erlang node programmatically when I know its -sname? If I don't want the heartbeat monitor to restart the process, how can I ensure that whatever answer is given for the above question will also kill the heartbeat? Is there a decent guide to deploying Erlang as a daemon? ...

How to run GUI application from userdefined boot time daemon server

Dear All, I am writing one simple server daemon and running with /etc/init.d/server its running properly but when i want to run one simple QT GUI with system() function , its not able to run it and returning 256 as return code . if same daemon i m running from terminal then its working properly and also system() function is getting succ...

call function at specific time intervals in Linux

What is the best way to call a function inside a Linux daemon at specific time intervals, and specific time (e.g. at 12am every day, call this function). I'm not referring to calling a process with crontab, but a function within a long running daemon. Thanks ...

Control Processes Started by Bash Daemon

In bash, I have created a simple daemon to execute commands when my internet connection changes: #!/bin/bash doService(){ while do checkTheInternetConnection sleep 15 done } checkTheInternetConnection(){ if unchanged since last check return else execute someCommand fi } someCommand(){...

Kill other bash daemons from the same script

I am having a hell of a time trying to write a "kill all other daemon processes" function for use within a bash daemon. I do not ever want more than one daemon running at once. Any suggestions? This is what I have: #!/bin/bash doService(){ while do something sleep 15 done } kil...

Is it possible to double-fork a process in Java?

I need to double-fork vmware so it doesn't inherit the terminal ID (TTY/pts). This is what I have so far, but I can't get access to the runtime.exec process to fork another process (which removes the terminal ID). Runtime runtime = Runtime.getRuntime(); Process proc = runtime.exec("vmware"); Is there a way to "daemonize" in Java? ...

Debugging Stale Ruby Process

Hi, I have a ruby script inside a Rails project. The script includes environment.rb so that Rails gets loaded etc. It then listens to data on a TCP socket of another server, parsing it to keep a mysql database up to date. I'm using the daemons gem to be able to start and stop the process easily. Iv had the script running in production w...

starting protocol in python with dameon + dbus

I've defined some protocol messages and every works on his own. These messages now needs to be connected. I think it will be all in a function called in the dameon mainloop or via DBus. The problems are: - threading is not allowed - the protocoll must be stateless - callable from a DBusInterface - also running on a daemon, that is the...

PowerShell Script Running as a Service Behaves Strangely

PowerShell Script Running as a Service Behaves Strangely The Project: Create a background process that determines if the on board network card is connected. If it is connected, disable the wireless network card. When the onboard network card is not connected, re-enable the wireless card. Why: Users hot-dock all the time, getting funky ...

How do I implement a simple cross platform Python daemon?

I would like to have my Python program run in the background as a daemon, on either Windows or Unix. I see that the python-daemon package is for Unix only; is there an alternative for cross platform? If possible, I would like to keep the code as simple as I can. ...

How to run a script on device mount in OSX.

I want to make a script that automatically backs up my kindle files when I connect it to my macbook pro. Writing the script is well within my ability, but I don't know what's the best way to run a script on mount automatically. ...

Unexpected heap usage in J2EE Struts app

I am having few queries regarding heap usage in my app. At instances it is observed that user activity is minimal (or nil ) on weekend but heap usage increases linearly, reaches the threshold causing the GC to kick in. I wish to analyze the cause of this heap usage and confirm if this is normal and expected. Assuming no user activity, th...

getting tty of caller in signal handler in php

Hi all, I just wrote php daemon for my app and want to implement some output information generated on specified signal (SIGUSR1). I got signal handler in code pcntl_signal(SIGUSR1, array($this, 'signal_status')); and function handler prepared protected function signal_status($signal_number) { printf("blah\n"); } Everything...