Questions tagged [daemon]

A daemon is a process or program that runs in the background (i.e. requiring no user interaction).

2503 questions
553
votes
26 answers

How do I run a node.js app as a background service?

Since this post has gotten a lot of attention over the years, I've listed the top solutions per platform at the bottom of this post. Original post: I want my node.js server to run in the background, i.e.: when I close my terminal I want my server…
Peter Kruithof
  • 9,284
  • 5
  • 27
  • 42
333
votes
8 answers

How to start a background process in Python?

I'm trying to port a shell script to the much more readable python version. The original shell script starts several processes (utilities, monitors, etc.) in the background with "&". How can I achieve the same effect in python? I'd like these…
Artem
  • 5,542
  • 6
  • 23
  • 26
302
votes
20 answers

A cron job for rails: best practices?

What's the best way to run scheduled tasks in a Rails environment? Script/runner? Rake? I would like to run the task every few minutes.
jes5199
  • 16,375
  • 11
  • 35
  • 40
254
votes
16 answers

How do you create a daemon in Python?

Searching on Google reveals x2 code snippets. The first result is to this code recipe which has a lot of documentation and explanation, along with some useful discussion underneath. However, another code sample, whilst not containing so much…
davidmytton
  • 35,554
  • 36
  • 83
  • 91
253
votes
24 answers

Docker command can't connect to Docker daemon

I want to make a move to Docker, so I've just started to mess around with it. I've installed Docker on a VirtualBox Ubuntu 15.10 (Wily Werewolf) installation and as suggested here I then tried running a basic nginx Docker image: $ docker run --name…
kramer65
  • 39,074
  • 90
  • 255
  • 436
251
votes
7 answers

Daemon Threads Explanation

In the Python documentation it says: A thread can be flagged as a "daemon thread". The significance of this flag is that the entire Python program exits when only daemon threads are left. The initial value is inherited from the creating…
Corey Goldberg
  • 53,391
  • 24
  • 118
  • 137
242
votes
8 answers

How to process SIGTERM signal gracefully?

Let's assume we have such a trivial daemon written in python: def mainloop(): while True: # 1. do # 2. some # 3. important # 4. job # 5. sleep mainloop() and we daemonize it using start-stop-daemon which…
zerkms
  • 230,357
  • 57
  • 408
  • 498
196
votes
16 answers

How do I run a Node.js application as its own process?

What is the best way to deploy Node.js? I have a Dreamhost VPS (that's what they call a VM), and I have been able to install Node.js and set up a proxy. This works great as long as I keep the SSH connection that I started node with open.
respectTheCode
  • 40,233
  • 16
  • 70
  • 84
180
votes
9 answers

What is the reason for performing a double fork when creating a daemon?

I'm trying to create a daemon in python. I've found the following question, which has some good resources in it which I am currently following, but I'm curious as to why a double fork is necessary. I've scratched around google and found plenty of…
Shabbyrobe
  • 11,310
  • 15
  • 55
  • 86
163
votes
15 answers

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…
Beier
  • 2,967
  • 10
  • 25
  • 23
125
votes
9 answers

Creating a daemon in Linux

In Linux I want to add a daemon that cannot be stopped and which monitors filesystem changes. If any changes are detected, it should write the path to the console where it was started plus a newline. I already have the filesystem changing code…
chrisMe
  • 1,253
  • 3
  • 9
  • 4
124
votes
6 answers

Getting pids from ps -ef |grep keyword

I want to use ps -ef | grep "keyword" to determine the pid of a daemon process (there is a unique string in output of ps -ef in it). I can kill the process with pkill keyword is there any command that returns the pid instead of killing it? (pidof or…
Dennis Ich
  • 3,045
  • 6
  • 23
  • 40
112
votes
20 answers

Check to see if python script is running

I have a python daemon running as a part of my web app/ How can I quickly check (using python) if my daemon is running and, if not, launch it? I want to do it that way to fix any crashes of the daemon, and so the script does not have to be run…
Josh Hunt
  • 12,949
  • 26
  • 73
  • 96
94
votes
13 answers

How do I daemonize an arbitrary script in unix?

I'd like a daemonizer that can turn an arbitrary, generic script or command into a daemon. There are two common cases I'd like to deal with: I have a script that should run forever. If it ever dies (or on reboot), restart it. Don't let there ever…
dreeves
  • 25,132
  • 42
  • 147
  • 226
92
votes
8 answers

How to stop Jenkins installed on Mac Snow Leopard?

I have installed Jenkins executable on OSX, but now I want to stop it running. Whenever I kill it, no matter how, it just restarts immediately. I've tried using the exit command on the jenkins url: http://localhost:8080/exit which asks me to post…
raksja
  • 3,781
  • 3
  • 34
  • 44
1
2 3
99 100