Daemon doesn't seem to start

Bill Rees brees at stacklighting.com
Wed Sep 30 05:15:19 UTC 2015


Following the code example in PEP3143 I wrote the code below.  Without the
daemon context I see a steady stream of writes to the output file,
/tmp/xxxx but with the daemon context there is nothing.  As far as I can
tell I'm preserving the file object and expect to see the same stream of
writes that I saw without the context.

The PEP code looks so simple and I think I've followed the pattern here
but there must be something wrong with what I've written but I can't see
it.  Is there something more to the PEP code?

try:
        mf = open("/tmp/xxxx", 'w+')
except (IOError, OSError) as e:
        print(" ".join(["Unable to open /tmp/xxxx:",\
            e.errno, e.strerror]))
        exit(0)

with daemon.DaemonContext(
        working_directory='/',
        umask=0o002,
        pidfile = lockfile.FileLock("/var/run/boo.pid"),
        signal_map = {
        signal.SIGHUP:   hup,
        signal.SIGQUIT:  quit,
        signal.SIGINT:   interrupt,
        },
        files_preserve = [mf]
):
        mf.write("Intro\n")
        while True:
                mf.write("1===================\n")
                time.sleep(10)
                mf.write("2===================\n")
                mf.flush()


-- 
*Bill Rees* *| *
Stack Labs | 10054 Pasadena Ave, Cupertino, CA 95014
brees @stacklighting.com <brees at stacklighting.com>


This electronic mail transmission may contain private, confidential and
privileged information that is for the sole use of the intended recipient.
If you are not the intended recipient, you are hereby notified that any
review, dissemination, distribution, archiving, or copying of this
communication
is strictly prohibited.  If you received this communication in error,
please reply to this message immediately and delete the original message
and the associated reply.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/python-daemon-devel/attachments/20150929/ef894d2b/attachment.html>


More information about the python-daemon-devel mailing list