BSD Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsBSD Help
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Intel® Graphics Performance Analyzers is a powerful tool suite for analyzing and optimizing your games, media, and graphics-intensive applications. Used by some of the best developers on the planet, Intel GPA lets you maximize your app’s performance.


Tutorials
| Forums

Download to Enter
| Contest Rules

DOWNLOAD INTEL® GPA FOR FREE

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 8th, 2005, 11:56 AM
BenZarboni BenZarboni is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 104 BenZarboni User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 5 h 47 m 55 sec
Reputation Power: 9
Daemon fun

Ok, so I've been playing aroud with BSD for a little bit, and would like to start modifying some stuff so it'll run on an embedded device.

Can anyone point me to a good resource to get me going on how to strip down a daemon so its as lean as possible. I know that's kinda vague, but I'm kinda new


Thx

BZ

Reply With Quote
  #2  
Old April 8th, 2005, 12:23 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 8,978 Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 6 Days 22 h 14 m 39 sec
Reputation Power: 3561
Read the pages for:
man 3 daemon

The following code prints "BOO!" every 60 seconds to your terminal.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(void) {
  daemon(0, 1);
  while (1) {
    printf("BOO!\n");
    sleep(60);
  }
  return 0;
}
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Diary of a first time dog owner <-- my cousin's blog

Reply With Quote
  #3  
Old April 8th, 2005, 05:51 PM
BenZarboni BenZarboni is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 104 BenZarboni User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 5 h 47 m 55 sec
Reputation Power: 9
Thanks for the help.

Its funny though, it brings up another issue I am trying to research. Your daemon repeats the same task every minute.

Is there a rule of thumb as to when you would create such a daemon vs using a cron-job?


BZ

Reply With Quote
  #4  
Old April 8th, 2005, 10:25 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 8,978 Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 6 Days 22 h 14 m 39 sec
Reputation Power: 3561
If the job is something relatively simple and will be done quickly, I would use a cron job.

If the job is relatively complicated and if multiple instances of the job running simultaneously is not desirable, I would use a daemon.

Also note that lots of ISPs don't like people running daemons on their computers.

Reply With Quote
  #5  
Old April 10th, 2005, 10:24 AM
stevengs stevengs is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Germany
Posts: 394 stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level)stevengs User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 3 Days 4 h 36 m 25 sec
Warnings Level: 10
Number of bans: 1
Reputation Power: 0
Quote:
Originally Posted by Scorpions4ever
Also note that lots of ISPs don't like people running daemons on their computers.


Hi Scorpions,
can you elaborate on that a bit please? Who's computers and what types of daemons do you mean?

Thanks

-STeven

Reply With Quote
  #6  
Old April 10th, 2005, 01:17 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 8,978 Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 39th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 6 Days 22 h 14 m 39 sec
Reputation Power: 3561
Quote:
Originally Posted by stevengs
Hi Scorpions,
can you elaborate on that a bit please? Who's computers and what types of daemons do you mean?

Thanks

-STeven

Try writing your own daemon on a computer that is owned by an ISP or a college network. It doesn't really matter what the daemon does, the sysadmins will kill the daemon first and ask questions later. Most good sysadmins that I know hate seeing any long running processes that they don't know anything about. Heck, I would probably do that myself, if I see a mysterious process that has been running for a few days on my computer. Wouldn't you?

The solution to the original poster would be: If you're going to run a long running daemon on someone else's computer, let the sysadmins know in advance .

Reply With Quote
  #7  
Old April 11th, 2005, 03:41 PM
BenZarboni BenZarboni is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 104 BenZarboni User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 5 h 47 m 55 sec
Reputation Power: 9
:P Thx! Will do. They are going to be my systems, so I won't have that problem.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsBSD Help > Daemon fun


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 1 - Follow our Sitemap