Questions tagged [daemon]

Computer program that runs as a background process, rather than being under the direct control of an interactive user.

423 questions
27
votes
1 answer

Why we use setsid() while daemonizing a process?

In order to create a service (daemon) we fork the parent and make it to exit while making the child to be the session leader by calling setsid(). Moreover why do we use setsid()? Our orphan process is taken care of by init(though in not all cases)…
Kalu
  • 469
4
votes
0 answers

Does fork & exit make a process a daemon?

int main() { if (!fork()) sleep(3000); exit(0); } Invoking the program above from the shell yields a orphan process which is adopted by init or upstart (on my Ubuntu Desktop) is in the same session as the shell lost group leader is not…
SedriX
  • 185
4
votes
2 answers

Should a well-behaved daemon daemonize itself?

In this answer, it is mentioned in passing that it is not appropriate for a daemon process to reparent itself to init with the double-fork-and-exit trick. The answer links to a website which is no longer live but I found it on the Internet Archive.…
Kevin
  • 766
1
vote
1 answer

Why does a daemon have no associated terminal?

I'm a bit riddled by the convention in creation of linux daemons. People mostly agree that what makes a daemon is no associated terminal. Also, in sample codes usually the processe's parent gets killed and the daemon reparents to init. I have no…
Pyjong
  • 139
1
vote
0 answers

CPU usage investigation and managing daemons

I am not sure, if this question belongs here or to software recommendation, but as it is strictly tied to linux kernel and is probably build-in, so I will risk and ask here (please move it if I am mistaken). I understand, that I can manage currently…
xinus01
  • 33
  • 4
1
vote
1 answer

Running daemon as regular application

There are tools that enable one to run a console command or a console application as a daemon. To "daemonize" it, so to say. Is there a way to run a daemon as a regular console application? I'm coding in KDevelop and don't see any options for daemon…
0
votes
0 answers

Why are most daemons shared objects

On redhat most of the systemd started services are implemented as shared objects. Why is this the case? For instance: file /usr/sbin/sshd file /usr/sbin/squid file /usr/sbin/crond file /usr/sbin/rsyslogd The output for all these daemons is ELF…
0
votes
1 answer

Server running but not serving

I have a simple python flask server that is started by start-stop-daemon. It was running well last week, and this monday I see that it is not serving anymore (curl http://localhost/mypage takes forever and never returns). Last log is from…
Thomas
  • 893