LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-25-2007, 11:07 PM   #1
sharad
Member
 
Registered: Dec 2005
Posts: 48

Rep: Reputation: 15
how to make an application as a service


Dear all,

I have one application that I am running on red hat linux. I want to make it as a service like other OS services such as network,vsftpd etc.

so could anybody please tell me how to do the same.

Kindly waiting for your reply.

Thanks & Regards,

Sharad.
 
Old 02-25-2007, 11:44 PM   #2
vswr31
Member
 
Registered: Apr 2004
Location: phoenix,az
Distribution: red hat/suse
Posts: 54

Rep: Reputation: 15
whats the app? What distro?
 
Old 02-26-2007, 03:11 AM   #3
varun_shrivastava
Member
 
Registered: Jun 2006
Distribution: Ubuntu 7.04 Feisty
Posts: 79

Rep: Reputation: 15
i think u want to make it as daemon
here is what i think u should do

Code:
int main()
{
    /*SOME CODE*/

    switch(fork())
    {
        case 0:
                setpgrp();//check for man page
                close(0);
                close(1);
                /* YOUR SERVICE PROGRAM CODE
                 -
                 -
                 -
                  */
                 //your service code should redirect
                 //stderr to a log file 
        default:
                sleep(1);
                printf("SERVICE STARTED\n");
                exit(0);
    }
}

Last edited by varun_shrivastava; 02-26-2007 at 03:15 AM.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Extending the GPL for application service providers LXer Syndicated Linux News 0 08-14-2006 02:03 PM
make service a program baambooli Slackware 2 05-09-2006 04:22 PM
How do I make something a system service? sloik2000 Linux - Software 3 03-25-2005 03:16 PM
help on hardware reqs for PHP Application Service Provider model dniry Linux - General 0 09-11-2003 05:55 PM
How To Program Daemon(Service) Application wlmapp3 Programming 6 07-23-2003 03:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:07 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
Open Source Consulting | Domain Registration