Ubuntu This forum is for the discussion of Ubuntu Linux. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
04-25-2007, 12:08 PM
|
#1
|
Member
Registered: Apr 2007
Location: México
Distribution: Slackware, Fedora
Posts: 61
Rep:
|
How to create a DAEMON
Hi, I need to create a daemon and I don't know how. I want to implement the RIP protocol, to connect my ubuntu distribution with a router, so I need to convert this protocol into a daemon. Any help?
Thanks in advance
|
|
|
04-25-2007, 12:20 PM
|
#2
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
Code:
while true;
do
... code goes here
.... blah blah.. echo "hi Im a daemon" > /var/log/daemon.log
.. blah more code..
done
There's definitely another more (correct) way to make an actual daemon, but this is the easy way. It's an infinite loop to do the stuff you need done, and when started with an '&' symbol, the shell will fork it into the background like a daemon.
Eg:
Code:
/etc/rc.d/rc.daeomn &
|
|
|
04-25-2007, 12:32 PM
|
#3
|
Member
Registered: Apr 2007
Posts: 31
Rep:
|
though you better take care not to overdo stuff in the while.
Remember.. it runs 'all' the time.
Maybe add a delay or hook into the fam if you have one running (<rolls his eyes>) or wait
for some trigger depending on your application.
|
|
|
04-25-2007, 12:33 PM
|
#4
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
Good point.. In my own daemon I made, I put a 'sleep 10' in the beginning, so the thing only looped every 10 seconds and then slept again.. In any event, the resource usage is undetectable. 
|
|
|
04-26-2007, 03:41 AM
|
#5
|
LQ Newbie
Registered: Apr 2007
Posts: 2
Rep:
|
I'm a total n00b in linux, so I don't understand what you did. I saw in other forums and some documents about a daemon called routed that manage RIP and I would like to know how to implement that.
Could you give a step by step answer? Thank you.
I need to make a router in linux with DHCP, DNS, NAT, FIREWALL and dynamic routing. DHCP, DNS, NAT and the FIREWALL it's already working, but the medular problem now it's the dynamic routing. I hope you could give me an step by step answer.
Last edited by TrAffIkK0; 04-26-2007 at 03:47 AM.
|
|
|
04-26-2007, 06:05 AM
|
#6
|
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594
|
Yikes  TraFFikko: Well, what you need as far as I know, is a firewall capable of dynamically altering the IPtables/IPchains on the fly. Doing this is well beyond my abilities, but you will get *some* information from Googling, and I'm sure there are other related threads here on LQ.
Don't quote me, but something like Guarddog or Smoothwall *might* be along the lines of what you seek.
Sorry I can't help on this subject, but there are some very able people around here and hopefully one or more of them will pick up on this and be able to offer some good advice. 
Best of luck!
P.S. - You would do well to post in the Networking forum.
Last edited by GrapefruiTgirl; 04-26-2007 at 06:06 AM.
|
|
|
04-26-2007, 06:08 PM
|
#7
|
LQ Newbie
Registered: Apr 2007
Posts: 2
Rep:
|
Thank you grapefuitgirl I'll check that
|
|
|
All times are GMT -5. The time now is 07:34 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|