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
97
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
  • 26,430
  • 45
  • 154
  • 229
96
votes
13 answers

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 sleep 1000 done In particular, I'm wondering if…
Shawn J. Goff
  • 4,635
  • 8
  • 34
  • 38
94
votes
9 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,969
  • 5
  • 38
  • 44
85
votes
2 answers

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 explanation about it is omitted. I search on the…
KopBob
  • 1,051
  • 1
  • 9
  • 15
83
votes
3 answers

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 even without it, basic Docker commands (eg, docker…
Steve Bennett
  • 114,604
  • 39
  • 168
  • 219
82
votes
3 answers

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 later. P.S. It would be really cool if you can also…
81
votes
3 answers

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 entire Python program exits when only daemon threads…
Falmarri
  • 47,727
  • 41
  • 151
  • 191
75
votes
11 answers

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 stop the program cleanly. I found this article…
Rich Apodaca
  • 28,316
  • 16
  • 103
  • 129
72
votes
2 answers

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 daemon process is tricky to get right, but the…
tauran
  • 7,986
  • 6
  • 41
  • 48
70
votes
4 answers

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?
Hortitude
  • 13,638
  • 16
  • 58
  • 72
70
votes
6 answers

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. The method I am using right now to keep the program…
Nate
  • 5,237
  • 7
  • 42
  • 52
70
votes
8 answers

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-daemon option. How do I end the process when moving…
Junya Kono
  • 1,121
  • 3
  • 10
  • 16
70
votes
10 answers

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 and write to it. FILE* log = fopen("logfile.log",…
codemonkey
  • 1,009
  • 2
  • 10
  • 16
68
votes
3 answers

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, call exit(). This ensures that the original…
Registered User
  • 5,173
  • 16
  • 47
  • 73
61
votes
4 answers

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 integration would also be nice, but I could always add…
jedihawk
  • 814
  • 1
  • 12
  • 12