Download your favorite Linux distribution at LQ ISO.
Go Back > Blogs > bogoda
User Name


Rate this Entry

Run Daemon in linux

Posted 01-13-2006 at 08:20 AM by bogoda

HI ,

I am new to Red Hat 9.

I want to know how can i create a Deamon program to run in linux when system boot up.

I run the following program.

But no out put.

I want set it as Daemon.

#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <syslog.h>
#include <string.h>

int main(void) {

/* Our process ID and Session ID */
pid_t pid, sid;

/* Fork off the parent process */
pid = fork();
if (pid < 0) {


/* Close out the standard file descriptors */

/* Daemon-specific initialization goes here */

/* The Big Loop */
while (1) {

printf("Inside Enter j:");
/* Do some task here ... */
sleep(100); /* wait 30 seconds */

Any one kow the solution plse.

Thank you.
Posted in Uncategorized
Views 1842 Comments 2
« Prev     Main     Next »
Total Comments 2


  1. Old Comment
    If any one know this.
    Posted 12-31-1969 at 07:00 PM by bogoda bogoda is offline
  2. Old Comment
    This(as well as the post above this) should be posted in the forums.
    Posted 12-31-1969 at 07:00 PM by bogoda bogoda is offline


All times are GMT -5. The time now is 01:08 PM.

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