[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?



-----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-----



 
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] *