[Mono-list] Deamonize. Running a Mono app. in the background
Michael Rasmussen
mir@miras.org
Tue, 15 Mar 2005 12:28:50 +0100
--=-N7XJK0lcxqa/CrXySWwB
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Hi List,
How does one run a Mono app. as a deamon?
In C/C++ I would do it this way:
pid_t pid, sid;
/* Fork off the parent process */
pid =3D fork();
if (pid < 0) {
exit(EXIT_FAILURE);
}
/* If we got a good PID, then
we can exit the parent process. */
if (pid > 0) {
exit(EXIT_SUCCESS);
}
/* Create a new SID for the child process */
sid =3D setsid();
Hilsen/Regards
Michael Rasmussen
Get my public GnuPG keys:
michael rasmussen cc
http://keyserver.veridis.com:11371/pks/lookup?op=3Dget&search=3D0xD3C9A00E
mir datanom net
http://keyserver.veridis.com:11371/pks/lookup?op=3Dget&search=3D0xE501F51C
mir miras org
http://keyserver.veridis.com:11371/pks/lookup?op=3Dget&search=3D0xE3E80917
--------------------------------------------------------------
There is no distinctly native American criminal class except Congress.
-- Mark Twain
--=-N7XJK0lcxqa/CrXySWwB
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: Dette er en digitalt underskrevet brevdel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQBCNsbyVErYVePoCRcRAv6GAJ4/meA/+6AkKog/IDiArMJNAILD8wCcCTqn
0xnU/4CVL4ABx4IzafPN26w=
=+YLG
-----END PGP SIGNATURE-----
--=-N7XJK0lcxqa/CrXySWwB--