tags:

views:

51

answers:

1
+1  Q: 

Installing Daemons

A simple link would be nice for me to understand how to install my C++ program as a daemon in UNIX, now I know some will say this should be on Server Fault, but as far as I understand it I need the init.d shell script to actually create the start and stop for the daemons.

But if you guys can show me a simple shell script for the daemon and the file directories every thing required is associated with, that would be great.

I was going to do this http://www.linux.com/archive/feed/46892 but if you read the comments every one is moaning x( .

P.S. I've already done the required code for C++ to run as a daemon; I just need to know how to actually install it as a daemon. At the moment I'm using crontab which is just not a good idea for the future of my problem.

Edit: OS: Fedora, Release 12 (Constantine)

+2  A: 

If you want to use the standard for your system, your best bet is to copy a file from /etc/init.d and modify it to suit your program. You will probably have to read several to get an idea of the common parts and best practice. Unfortunately, each distribution has its own notion of how best to structure (and locate) those files, so we would need more information to give you specific advice.

Alternatively, you could use a supervisor program like D. J. Bernstein's supervise, but that's probably more advanced than you really want to deal with right now.

eswald
i am looking at /etc/init.d/... in fedora and im sort of understanding. Any suggestions for the best file to look at for beginers :D
Shahmir Javaid
/etc/init.d/cron looks like the simplest on a Red Hat box I have access to. The good news is that they're just shell scripts with a few extra conventions.
eswald