LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 04-25-2007, 12:08 PM   #1
SlacUser
Member
 
Registered: Apr 2007
Location: México
Distribution: Slackware, Fedora
Posts: 61

Rep: Reputation: 15
Question 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
 
Old 04-25-2007, 12:20 PM   #2
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
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 &
 
Old 04-25-2007, 12:32 PM   #3
hashash
Member
 
Registered: Apr 2007
Posts: 31

Rep: Reputation: 15
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.
 
Old 04-25-2007, 12:33 PM   #4
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
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.
 
Old 04-26-2007, 03:41 AM   #5
TrAffIkK0
LQ Newbie
 
Registered: Apr 2007
Posts: 2

Rep: Reputation: 0
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.
 
Old 04-26-2007, 06:05 AM   #6
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
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.
 
Old 04-26-2007, 06:08 PM   #7
TrAffIkK0
LQ Newbie
 
Registered: Apr 2007
Posts: 2

Rep: Reputation: 0
Thank you grapefuitgirl I'll check that
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create bridge and how to create hub? Grawp Linux - Networking 5 04-22-2007 05:10 AM
Samba: "homes" share, cannot create directories, can create files Herg Linux - Software 1 09-14-2006 08:48 AM
howto create daemon (service) under suse ? cccc Suse/Novell 2 08-17-2006 05:53 PM
damon programming....Why cant my daemon create files? vimes Programming 4 03-16-2006 05:38 AM
Linux, Create Dirs=no, Create files=yes. Possible? tisource Linux - General 4 01-12-2004 10:05 PM


All times are GMT -5. The time now is 05:31 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration