daemon

Why does using threading.Event result in SIGTERM not being caught?

I have a threaded Python daemon. Like any good daemon, it wants to launch all of its worker threads, then wait around until it's told to terminate. The normal signal for termination is SIGTERM, and in most languages I'd hold to terminate by waiting on an event or mutex, so using threading.Event made sense to me. The problem is that Pytho...

queque system that manages load

I need a queque system that runs as fast as possible but doesn't slow down the server. I have a web app (php) that converts different pieces of media (photos,video,etc). When someone wants to convert a file the command to convert goes into a database. I need a program that can run the commands in a way that will not crash my server. I...

What's the best practice to denormalize in CQRS?

I am trying to create a deamon to denormalize my Database. I use ActiveMQ as queue manager I have 2 data bases: Relational one (write + replication), and denormalized one (for reads) My question is what's the best practice to denormalize my real DB I have some ideas: MySQL proxy (with lua) which reads the Queue (is this possible) Tri...

Scalable, Delayed PHP Processing

I'm working on an online PHP application that has a need for delayed PHP event. Basically I need to be able to execute arbitrary PHP code x many seconds (but it could be days) after the initial hit to a URL. I need fairly precise execution of these PHP event, also I want it to be fairly scalable. I'm trying to avoid the need to schedule ...

User agent or daemon?

I am writing driver to a HID device. The driver opens HID device in exclusive access mode. This driver should run for all user. So it should be either User agent or daemon. In driver I use some CoreGraphics API's which is under ApplicationService framework but Technote say's daemon won't get access to ApplicationService framework. So...

Inter application communication - which approach to take?

Hello, I'm making a little application which will control a sort of a hardware indicator thingie (usable as a volume indicator, processor load meter and such). My goal is to make the device accessible to other applications as easily as possible. What would be the best approach to go about this? I was thinking making a "web" service on...

Continually output file content to console?

Quick question, hopefully... I'm building an application with a fairly extensive log file. I'd like the ability at any time to monitor what a specific instance of my application is doing. I could open and close the log file a bunch of times, but its kind of a pain. Optimally, as lines are written to the log file, they would be written to...

Relocating /proc/proc_id/ kind of directories in linux

I am writing a daemon in c++ on linux which would launch many processes. I'm considering a scenario when the daemon itself is killed. On restarting the daemon, I would like to kill all other processes launched by this daemon. Ideally I would like all the processes created by this daemon to die if it is killed. I'm considering a scenar...

writing java deamon or background program

I am creating an administration panel for project and I need to write some background program or daemon to control different modules. I need to create GUI with buttons to start, stop, restart modules. So, now i need to find the best solution for doing this. So what could you suggest: use some code snipets or some other projects for wri...

screenshot-grabbing email tool

I have a web site with various graphs embedded in it that are generated externally. Occasionally those graphs will fail to generate and I would like to catch that when it happens. These graphs are embedded in multiple pages and I would rather not check each page manually. Is there any kind of tool or perhaps a browser addon that could...

check if mysql connection is valid

I have a long running php script which is basically an infinite loop listening for events (its an xmpp bot), I start the script with nohup php bot.php &. The raw structure of the script is like $mysqli = mysqli_connect(...); while(1) { if(event1) { // do database action } else if(event2) { // non database action ...

Run Linux commands from Daemon

Hi, I need to run a linux command such as "df" from my linux daemon to know free space,used space, total size of the parition and other info. I have options like calling system,exec,popen etc.. But as this each command spawn a new process , is this not possible to run the commands in the same process from which it is invoked? And at...

Testing a Linux daemon on an embedded system

I have written a daemon in linux for doing dhcp for an embedded system. This platform only has a linux kernel running on it and have no CLI support. What is the best way for me to test my daemon? How do I write a program that will call the main function in this daemon and verify if its working fine? Appreciate the answers. ...

Periodic Script- Daemon-

Hi i have hp-ux and i need delete a specific file every day. then I need to do a shell script or something else with a simple command for example # rm <filename> But i need add this script to init, or convert this script in daemon TO GRANT that every day at 20:00, this script run and delete the file. I guess that the above is the pro...

Setting hudson to operate on current user/root level On Ubuntu?

Hello guys I have an Ubunto system with hudson running as a daemon with an init (start/stop) script. Unfortunately every time I'm trying to run a build, hudson fails to access the pom file, since hudson is running under hudson user, rather then the current user logged into ububntu that has full root rights and can run build. I tried add...

Why in PHP CLI getmypid() returns 0 as a pid?

I'm developing a long running command line script and of course I want in not to launch itself more than once. So I write a .pid file and on launch check if a process with such PID exists. The problem is on Windows it returns 0 as a PID, so I always get a process by that PID running (System Idle has PID 0). Does someone know how to fix ...

Benefits of Tomcat (or equivalent) for a simple service

I'll need to develop a Java service that is simple because: It only communicates via a TCP socket, no HTTP. It runs on a dedicated server (there are no other services except the basic SSH and such) Should I make this a standalone service (maybe in something like Java Service Wrapper) or make it run in a container like Tomcat? What ar...

Python daemonize

Hi, I would like to daemonize a python process, and now want to ask if it is good practice to have a daemon running, like a parent process and call another class which opens 10-30 threads. I'm planning on writing a monitoring script for group of servers and would like to check every server every 5 mins, that each server is checked ex...

Embedded cue in Flac file not working

Hi, I have ripped a CD in EAC into 1 single flac file with an embedded cue sheet file. As for as i can see mpd supports this, but i cant get it to read it. If i use foobar2000 i can see that they are there but mpd see's it as a single large file. Any ideas? ...

Add to $PATH in linux so that it's available to daemons

Where can I add to a $PATH so that it's available to all daemons? So that it's "included" or "sourced" before daemons start? Many thanks! ...