Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Creating a Daemon

Posted on 1998-11-09
4
Medium Priority
?
288 Views
Last Modified: 2010-04-20
I need to make a process into a daemon either through the command line or programmatically.  (command line, preferred)

0
Comment
Question by:dpeng
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Accepted Solution

by:
harrys earned 150 total points
ID: 1638458
from the comandline you could start it with
daemon&
which pushes it to the background.
in a program you would call fork() which starts a childprocess, then  inside the child  close the  stdin/stdout/stderr filehandles (see the manualpage of fork for details how
to detect who the child is..) and the child is you new daemon. inside the parent just
terminate the process.

0
 

Expert Comment

by:overcode
ID: 1638459
Linux Journal ran an article on daemons a while back, complete with code samples. It might be available on their web site.

-Reeves
0
 
LVL 2

Expert Comment

by:benten
ID: 1638460
What do you mean by a daemon?  Most programs that are considered daemons first fork a new process, orphan the child (by having the parent exit), close all the file descriptors and reset the session ids.
0
 

Author Comment

by:dpeng
ID: 1638461
Alright I'll try it out.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question