[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] Hvordan laver jeg en Daemon?



søn, 22 05 2011 kl. 01:23 +0200, skrev Robert Larsen:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 2011-05-21 22:49, Lars Nielsen wrote:
> >>
> > Hej Robert,
> 
> > Tak for din mail. Nu har jeg fået kigget lidt nærmere på sagerne,
> > og har lavet en lille daemon i c++ via fork() og set_sid()
> > funktionerne. Det ser ud til at daemon() funktionen blot er en
> > wrapper omkring disse to funktioner, men med noget fejlhåndtering
> > indbygget.
> 
> > Mvh Lars
> 
> 
> Det har du tilnærmelsesvis ret i, men den gør meget mere end det.
> Den skifter umask til 0 og afhængig af argumenterne skifter den også
> present working directory to rod biblioteket (så den ikke fastholder
> et mountpoint) samt redirecter standard in, out og error til /dev/null.
> 
> Den her artikel forklarer daemon processer ret godt:
> http://www.enderunix.org/docs/eng/daemon.php
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAk3YSYgACgkQzDMeisFqGZbrGgCfXBrtJlazAXQb5sBmSW/gAsau
> 9RsAoLl0uZjUrw2tN9AIu4IvTy+Z63eo
> =thPw
> -----END PGP SIGNATURE-----
> 
Ja jeg var lidt hurtig i min beskrivelse! Jeg var bare glad for at have
fået en daemon til at køre! :-) Der er selvfølgelig også lidt mere
fejl-håndtering indbygget i daemon() funktionen.

Det er en god artikel du fandt der. Jeg har læst nogle stykker lignende,
og de har alle nogenlunde samme opskrift. Jeg fik det meste til at virke
i går, nu mangler jeg bare mutual exclusion vha en lock-file.

Mvh Lars



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2011-06-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *