On 17/01/2007, at 5:00 PM, Jay wrote:
Hi All,
I've been using PyMSNt with OS X Server's jabber server
implementation for over a year now quite successfully, with full
file transfer and avatar support. Many thanks to James and everyone
else!
I've been looking at ways to get it to start automatically and/or
synchronized with the start and stopping of jabberd, and the
"recommended" method for accomplishing anything like this on OS X
is with the use of something called launchd, which has been
proposed to replace the following components in Apple's unixy OS X:
init, mach_init, xinetd, RC, SystemStarter, watchdog, and cron.
Basically, you setup a launchd job to launch PyMSNt.py based on any
parameters (e.g. at startup, by watching a dir, etc.). However, my
launchd job is failing, and I think it might have something to do
with launchd's expectations of PyMSNt.py. Would someone be kind
enough to let me know if PyMSNt.py matches those as described:
=====================================================================
EXPECTATIONS
Daemons or agents managed by launchd are expected to behave
certain ways.
A daemon or agent launched by launchd MUST NOT do the
following in the
process directly launched by launchd:
o fork(2) and have the parent process exit(3) or _exit
(2).
o Call daemon(3)
A daemon or agent launched by launchd SHOULD NOT do the
following as a
part of their startup initialization:
o Setup the user ID or group ID.
o Setup the working directory.
o chroot(2)
o setsid(2)
o Close "stray" file descriptors.
o Change stdio(3) to /dev/null.
o Setup resource limits with setrusage(2).
o Setup priority with setpriority(2).
o Ignore the SIGTERM signal.
A daemon or agent launched by launchd SHOULD:
o Launch on demand given criteria specified in the XML
property
list. More information can be found in launch(3).
o Catch the SIGTERM signal.
=====================================================================
I'm 99% sure PyMSNt does properly catch the SIGTERM signal, but
unfortunately, that's the extent of my knowledge with regard to
these expectations.
FWIW, my launchd job is simply configured to launch PyMSNt.py at
startup as the jabber user using the following command:
/usr/bin/python /var/jabber/modules/pymsnt/PyMSNt.py
It does successfully start it, but is incapable of monitoring it
(which would be ideal, as it could alter stop it based on other
events)
Any insight would be gratefully appreciated and shared within the
OS X Server community.
Kind regards and thanks,
Jay
I'd double check that you don't have the <background/> option set in
config.xml, because that causes the transport to fork when run. The
transport does set up the working directory, but that is necessary. I
don't know why launchd would forbid that.
It doesn't chroot, or change uid/gid or anything like that, and it
definitely obeys SIGTERM. When it receives SIGTERM it quits, as
expected.
If you figure out how to get all this working it'd be much
appreciated if you could write a little howto and I'll integrate it
with the docs.
Good luck!
---
James
_______________________________________________
py-transports mailing list
[email protected]
http://www.modevia.com/cgi-bin/mailman/listinfo/py-transports