LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-29-2008, 06:13 PM   #1
Reema
LQ Newbie
 
Registered: Apr 2008
Posts: 2

Rep: Reputation: 0
How to make a given process a daemon in linux


Hi,

Can someone please help me in knowing how to make any process daemon and also i need to find the parent process id of a process. How can i achieve these tasks.

Thanks
 
Old 04-29-2008, 07:18 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,374

Rep: Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383
Well, a daemon needs to be an infinite loop internally with some way of stopping it, possibly externally via kill).
to launch one use

nohup /path/to/my/daemon &

which detaches it from the terminal (nohup) and puts it in the background (&)

you can get the pid from the internal bash var $$, then use
ps -ef|grep $$ |grep -v grep|grep -v ps
and the 2nd num returned is the parent id
 
Old 04-29-2008, 07:31 PM   #3
Reema
LQ Newbie
 
Registered: Apr 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks a lot for the help!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
daemon process mallikk_in Linux - Networking 4 05-09-2007 08:49 AM
something is killing my daemon process KM3 Linux - General 1 10-23-2006 10:43 AM
unknown daemon process swmok Linux - Software 2 01-04-2005 11:10 PM
How do I make a daemon in python for linux? koppertop Linux - Software 1 08-13-2004 10:43 AM
Help, daemon process failed! Joran Linux - Networking 2 08-03-2003 05:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration