Questions tagged [daemon]
A daemon is a process or program that runs in the background (i.e. requiring no user interaction).
daemon
2,648
questions
662
votes
31
answers
861k
views
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, ...
412
votes
11
answers
682k
views
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 ...
343
votes
11
answers
313k
views
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()
...
306
votes
21
answers
121k
views
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.
301
votes
9
answers
177k
views
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 ...
285
votes
16
answers
366k
views
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 ...
265
votes
26
answers
293k
views
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 ...
212
votes
9
answers
76k
views
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'...
205
votes
17
answers
107k
views
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 ...
181
votes
5
answers
465k
views
How to stop docker under Linux
My version of OS Ubuntu 16.04.
I want to stop docker, so I run in the terminal:
sudo systemctl stop docker
But this commands doesn't help me:
gridsim1103 ~: ps ax | grep docker
11347 ? Sl ...
171
votes
15
answers
174k
views
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 ...
155
votes
6
answers
244k
views
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 ...
144
votes
9
answers
290k
views
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.
...
129
votes
21
answers
221k
views
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 ...
117
votes
39
answers
365k
views
Android Studio Gradle project "Unable to start the daemon process /initialization of VM"
Version of Android Studio (Beta) 0.8.4
OS version: Windows 8
Java JRE/JDK version: 1.8.0_11
Error:Unable to start the daemon process.
This problem might be caused by incorrect configuration of the ...
102
votes
4
answers
206k
views
Run a shell script and immediately background it, however keep the ability to inspect its output
How can I run a shell script and immediately background it, however keep the ability to inspect its output any time by tailing /tmp/output.txt.
It would be nice if I can foreground the process too ...
98
votes
13
answers
231k
views
Best way to make a shell script daemon?
I'm wondering if there is a better way to make a daemon that waits for something using only sh than:
#! /bin/sh
trap processUserSig SIGUSR1
processUserSig() {
echo "doing stuff"
}
while true; do
...
97
votes
13
answers
46k
views
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 ...
94
votes
9
answers
76k
views
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:
...
91
votes
2
answers
54k
views
What is the difference between nginx daemon on/off option?
This is my first web-server administration experience and I want to build docker container which uses nginx as a web-server. In all docker tutorial daemon off; option is put into main .conf file but ...
86
votes
3
answers
197k
views
What does the DOCKER_HOST variable do?
I'm new to Docker, using Boot2Docker on OSX. After booting it, this message is given:
To connect the Docker client to the Docker daemon, please set
export DOCKER_HOST=tcp://192.168.59.103:2375
Yet ...
85
votes
3
answers
108k
views
Meaning of daemon property on Python Threads
I'm a little confused about what setting a thread to be a daemon means.
The documentation says this:
A thread can be flagged as a “daemon
thread”. The significance of this flag
is that the ...
76
votes
9
answers
227k
views
How to kill the pm2 --no-daemon process
I'm using pm2 as the process manager of Node.js.
In many cases, I think I will run it as a daemon process, but if you use it locally as debugging, I think that there are times when you use the --no-...
76
votes
11
answers
108k
views
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 ...
75
votes
6
answers
61k
views
How best do I keep a long running Go program, running?
I've a long running server written in Go. Main fires off several goroutines where the logic of the program executes. After that main does nothing useful. Once main exits, the program will quit. ...
74
votes
4
answers
50k
views
What's the difference between nohup and a daemon?
What are the implications of running a script as a daemon versus using nohup?
I know what the difference is in terms of forking processes etc., but what impact does that have on my script?
72
votes
2
answers
75k
views
Python script as linux service/daemon
Hallo,
I'm trying to let a python script run as service (daemon) on (ubuntu) linux.
On the web there exist several solutions like:
http://pypi.python.org/pypi/python-daemon/
A well-behaved Unix ...
70
votes
10
answers
69k
views
Daemon logging in Linux
So I have a daemon running on a Linux system, and I want to have a record of its activities: a log. The question is, what is the "best" way to accomplish this?
My first idea is to simply open a file ...
69
votes
3
answers
58k
views
How to make a daemon process
I am trying to understand how can I make my program a daemon. So some things which I came across are in general, a program performs the following steps to become a daemon:
Call fork().
In the parent,...
61
votes
21
answers
168k
views
Android Studio: Unable to start the daemon process
I'm facing the below error when I'm trying to import a gradle project in Android Studio.
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For ...
61
votes
4
answers
73k
views
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 ...
60
votes
5
answers
29k
views
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 ...
58
votes
5
answers
69k
views
Couldn't connect to Docker daemon on Mac OS X
I would like to run multi-container application using docker-compose on Mac OS X El Capitan (v10.11.2).
However, the command $ docker-compose up command complains that it can't connect to the Docker ...
53
votes
8
answers
27k
views
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'...
52
votes
6
answers
56k
views
How do I get my Golang web server to run in the background?
I have recently completed the Wiki web development tutorial (http://golang.org/doc/articles/wiki/). I had tons of fun and I would like to experiment more with the net/http package.
However, I noticed ...
52
votes
7
answers
22k
views
How do I code a Mono Daemon
I'm trying to write a Mono C# daemon for linux.
I'd like to do a starts and stops of it when its done processing instead of just killing the process.
Does anyone have any examples of this?
Edit: I ...
51
votes
12
answers
75k
views
Docker: Are you trying to connect to a TLS-enabled daemon without TLS?
On Linux Mint 17.1 x86_64 with kernel 3.13.0-48-generic and OpenSSL version 1.0.1f-1ubuntu2.11; whenever I try to execute any docker command (like docker login or docker run hello-world), I get the ...
49
votes
6
answers
45k
views
Linux daemonize
I am writing a Linux daemon . I found two ways to do it.
Daemonize your process by calling fork() and setting sid.
Running your program with &.
Which is the right way to do it?
49
votes
1
answer
1k
views
How to deal with Mac OS X Helper/Main app architecture regarding core data, shared preferences and notifications?
I'm having some architectural doubts about a project (Mac OS X app) I'm working on. It basically consists of two elements: a daemon that runs in the background gathering some data and a viewer used to ...
46
votes
3
answers
34k
views
Cannot find the daemon.json file in windows 10 after docker-desktop installation
I installed the docker-desktop in windows 10 using the installer. Now i want to see the configuration file daemon.json. The official documentation says that
The default location of the ...
46
votes
2
answers
30k
views
Killing gracefully a .NET Core daemon running on Linux
I created a .NET Core console application running as a daemon on a Ubuntu 14.04 machine.
I want to stop the service without forcing it, being able to handle a kill event.
How can I achieve this?
44
votes
3
answers
37k
views
Daemon vs Upstart for python script
I have written a module in Python and want it to run continuously once started and need to stop it when I need to update other modules. I will likely be using monit to restart it, if module has ...
43
votes
2
answers
16k
views
Cross-platform background service in .NET Core (think windows service/unix daemon)?
So I have an app that is composed from an API and a Windows service (wrapped by Topshelf) that is continuously listening for events using RabbitMQ and processes data on demand.
For education and fun, ...
41
votes
3
answers
42k
views
How do I run long term (infinite) Python processes?
I've recently started experimenting with using Python for web development. So far I've had some success using Apache with mod_wsgi and the Django web framework for Python 2.7. However I have run into ...
41
votes
7
answers
45k
views
How do I set up a daemon with python-daemon?
I'm new to daemons so apologies if this is a newbie question.
In several other answers (for example, this question) people suggested the python-daemon package was the way to go because it fully ...
40
votes
1
answer
12k
views
What is the minUptime
I am using forever with my project. What do these options do:
minUptime
spinSleepTime
I didn't understand from GitHub page.
39
votes
4
answers
70k
views
Docker deamon config path under mac os
I am using docker in Version 1.12.0 (build 10871) on Mac OS (El Capitan 10.11.4) and I want to provide a config file for the docker daemon.
Under Ubuntu you place the config under /etc/default/docker ...
38
votes
5
answers
53k
views
How can I launch a new process that is NOT a child of the original process?
(OSX 10.7) An application we use let us assign scripts to be called when certain activities occur within the application. I have assigned a bash script and it's being called, the problem is that what ...
37
votes
4
answers
44k
views
Daemon and Service Difference
What is the difference between daemon and service ? (In windows or Linux).
36
votes
3
answers
60k
views
Efficient Python Daemon
I was curious how you can run a python script in the background, repeating a task every 60 seconds. I know you can put something in the background using &, is that effeictive for this case?
I was ...