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
28
votes
5 answers

setting NODE_ENV for node.js + expressjs application as a daemon under ubuntu

i got the daemon working alright with these instructions: http://kevin.vanzonneveld.net/techblog/article/run_nodejs_as_a_service_on_ubuntu_karmic/ but because this starts the application in DEVELOPMENT mode, the log file gets spammed with socket.io…
Philipp Kyeck
  • 18,402
  • 15
  • 86
  • 123
28
votes
3 answers

What are the behavioral differences between a daemon and a normal process?

I know that daemons run in the background mostly i.e. they require very less interaction from the user. Wikipedia lists some of the types of daemons that commonly exist: Dissociating from the controlling tty Becoming a session leader Becoming a…
Lazer
  • 90,700
  • 113
  • 281
  • 364
28
votes
2 answers

Create a daemon with double-fork in Ruby

What is the proper way to create a well-behaved Unix or Linux daemon in Ruby? What is the definition of a well-behaved daemon anyway, and how would one write such a program in Ruby?
JasonSmith
  • 72,674
  • 22
  • 123
  • 149
28
votes
3 answers

Does endless While loop take up CPU resources?

From what I understand, you write your Linux Daemon that listens to a request in an endless loop. Something like.. int main() { while(1) { //do something... } } ref: http://www.thegeekstuff.com/2012/02/c-daemon-process/ I read that…
resting
  • 16,287
  • 16
  • 59
  • 90
27
votes
2 answers

Why MUST detach from tty when writing a linux daemon?

When i tried to write a daemon under linux using C, i was told i should add following code after fork code block: /* Preparations */ ... /* Fork a new process */ pid_t cpid = fork(); if (cpid == -1){perror("fork");exit(1);} if (cpid >…
OriginalWood
  • 391
  • 1
  • 4
  • 9
27
votes
4 answers

Call to daemon in a /etc/init.d script is blocking, not running in background

I have a Perl script that I want to daemonize. Basically this perl script will read a directory every 30 seconds, read the files that it finds and then process the data. To keep it simple here consider the following Perl script (called…
tony
  • 618
  • 1
  • 6
  • 12
27
votes
7 answers

java background/daemon/service cross platform best practices

I am looking for the best way to make my desktop java program run in the background (daemon/service?) across most platforms (Windows, Mac OS, Linux [Ubuntu in particular]). By "best way" I am hoping to find a way that will: require a minimum amount…
Jack
  • 20,735
  • 11
  • 48
  • 48
26
votes
1 answer

How can I script GNU Screen to start with a program running inside of it so that it does not exit the session on program completion?

How can I script GNU Screen to start with a program running inside of it so that it does not exit the session when the program completes? I want to run an interactive program as a daemon, if I manually start screen and then launch this program…
TafT
  • 2,764
  • 6
  • 33
  • 51
26
votes
5 answers

Make a Ruby program a daemon?

I want to write a Ruby program that will always be running in the background (a daemon) on my Mac. Can someone point me in the right direction on how this would be done?
ab217
  • 16,900
  • 25
  • 74
  • 92
26
votes
7 answers

How to IPC between PHP clients and a C Daemon Server?

and thanks for taking a look at the question. The background I have several machines that continuously spawn multiple (up to 300) PHP console scripts in a very short time frame. These scripts run quickly (less than a second) and then exit. All of…
Alex Recarey
  • 20,178
  • 4
  • 25
  • 22
25
votes
8 answers

Check what a running process is doing: print stack trace of an uninstrumented Python program

Is there a way on Linux to check what a running Python daemon process is doing? That is, without instrumenting the code and without terminating it? Preferably I'd like to get the name of the module and the line number in it that is currently…
Björn Lindqvist
  • 19,221
  • 20
  • 87
  • 122
25
votes
3 answers

What is the de facto library for creating Python Daemons

I am attempting to use the python-daemon library which seemed to me to be the safest way to create a Daemon without forgetting anything. The documentation is quite poor, being just PEP 3143. On the other hand, I have found a lot of links to Sander…
Marcus Whybrow
  • 19,578
  • 9
  • 70
  • 90
25
votes
2 answers

Why are daemons called daemons?

It has been itching me for a long time to know what the historical reason for calling daemon programs or threads "daemon" Lat: daemon, latin version of the Greek "δαίμων" ("godlike power, fate, god") god, a subordinate deity, as the genius of a…
Sebastian Wozny
  • 16,943
  • 7
  • 52
  • 69
24
votes
4 answers

Emacs: GUI with emacs --daemon not loading fonts correctly

I set up an emacs --daemon in order to startup emacs faster. I like especially the GUI version of emacs, so I do emacsclient -c to open a new emacs frame. The problem is that I have changed my fonts, but these fonts aren't loaded if I start…
phimuemue
  • 34,669
  • 9
  • 84
  • 115
24
votes
4 answers

Executing shell script with system() returns 256. What does that mean?

I've written a shell script to soft-restart HAProxy (reverse proxy). Executing the script from the shell works. But I want a daemon to execute the script. That doesn't work. system() returns 256. I have no clue what that might mean. #!/bin/sh # save…
Jan Deinhard
  • 19,645
  • 24
  • 81
  • 137