LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-23-2012, 06:39 AM   #1
Anuradha12345
LQ Newbie
 
Registered: May 2012
Posts: 10

Rep: Reputation: Disabled
Unhappy I have C file and i want it to run as a daemon process in linux.


I have C file and i want it to run as a daemon process in linux.I m new to linux i dont no how i can make a a c file to run as a daemon process? Help me out.
 
Old 08-23-2012, 06:44 AM   #2
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 647

Rep: Reputation: 189Reputation: 189
You can't run a C file, as it's only a source code file.
You probably meant you've got a C program of your own you want to daemonize.
A daemon is just a program that "lurks in the dark" waiting for some stimuli to perform some action. Those stimuli could be signals, incoming connections, input from a pipe etc. In general, they're all stimuli which the daemon process needs to wait for performing a blocking wait, i.e. a read() syscall.
Without further detail as what this daemon needs to do I cannot say anything more.

Last edited by 414N; 08-23-2012 at 06:45 AM.
 
Old 08-23-2012, 06:59 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by Anuradha12345 View Post
Help me out.
Adding "Please" would be a good start.

A C file first needs to be compiled into executable code. If that's new to you, then learn the basics of compilation before worrying about special-purpose SW such as Daemons.
 
Old 08-23-2012, 07:01 AM   #4
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,864
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
something like this:

Code:
cd /; nohup yourprogramname &>/dev/null &
 
  


Reply



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
Not able to redirect commands output from the daemon process to file. maheshebhole Programming 2 05-25-2012 05:06 AM
How to find which process started a daemon process in autostart? indiajoe Linux - Desktop 4 10-25-2011 02:19 AM
How to run daemon process being a normal user [not root user]. narendra1310 Linux - Software 1 10-26-2009 09:48 AM
How to make a given process a daemon in linux Reema Linux - Newbie 2 04-29-2008 07:31 PM
Enable daemon to run with service daemon start,etc baddah Programming 6 12-02-2007 05:51 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:08 AM.

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
Open Source Consulting | Domain Registration