Questions tagged [daemon]

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

Daemon processes are background programs found in Linux/Unix systems that are typically started during the booting sequence. They perform special management and utility functions, which may either perform consistent tasks like polling (i.e. the syslogd daemon) or wait for a command to do something (like handling setup of new SSH connections via the sshd daemon).

They can be initiated after start time using the systemctl command:

$systemctl start daemon.service

Some commonly used daemons include:

  • httpd (HTTP web server management)
  • mountd (Mounting of file systems)
  • nfsd (Sharing of network files)
  • routed (Management of routing tables)
  • ntpd (Network time protocol administering)
  • dhcpd (Dynamic host configuration protocol administering)
2634 questions
651
votes
30 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
  • 10,584
  • 6
  • 29
  • 42
399
votes
10 answers

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
  • 6,420
  • 6
  • 26
  • 26
319
votes
10 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
  • 249,484
  • 69
  • 436
  • 539
306
votes
21 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
  • 18,324
  • 12
  • 36
  • 40
295
votes
9 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
  • 59,062
  • 28
  • 129
  • 143
281
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
  • 38,604
  • 37
  • 87
  • 93
262
votes
25 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
  • 50,427
  • 120
  • 308
  • 488
208
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
  • 12,298
  • 15
  • 60
  • 87
203
votes
17 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
  • 42,348
  • 18
  • 73
  • 86
170
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
  • 3,127
  • 10
  • 28
  • 24
159
votes
5 answers

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 0:00 containerd-shim…
Kenenbek Arzymatov
  • 8,439
  • 19
  • 58
  • 109
147
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,585
  • 6
  • 27
  • 44
141
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,413
  • 3
  • 10
  • 4
129
votes
21 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
  • 14,225
  • 26
  • 79
  • 98
113
votes
38 answers

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 daemon. For example, an unrecognized jvm option is…
AsimRazaKhan
  • 2,154
  • 3
  • 22
  • 36
1
2 3
99 100