Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Outdated egg! This is an egg for CHICKEN 3, the unsupported old release. You're almost certainly looking for [[/eggref/4/daemon-tools|the CHICKEN 4 version of this egg]], if it exists. If it does not exist, there may be equivalent functionality provided by another egg; have a look at the [[https://wiki.call-cc.org/chicken-projects/egg-index-4.html|egg index]]. Otherwise, please consider porting this egg to the current version of CHICKEN. [[tags:eggs]] [[toc:]] == daemon-tools === Introduction Collection of utility functions for implementing daemons with chicken. At the moment it provides an interface to {{openlog(3)}} and {{syslog(3)}} and a daemonize function to put the current process in the background. === Examples ==== Daemonize To put the process in the background (fork, detach from the controlling terminal, create a new session, etc.) just invoke: <enscript highlight=scheme>(daemon:ize)</enscript> ==== Logging to syslog You can optionally call {{daemon:openlog}} to set the process name and various options. See the {{openlog(3)}} manpage for details. <enscript highlight=scheme>(daemon:openlog "my-daemon" daemon:LOG-PID daemon:LOG-USER)</enscript> To write a log message use: <enscript highlight=scheme>(daemon:syslog daemon:LOG-WARNING "this is the ~a warning" "last")</enscript> === Authors Hans Bulfone <jsb@nil.at> === License Copyright (c) 2007 Hans Bulfone <jsb@nil.at> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. === Requirements This egg doesn't depend on other eggs. === Daemonize <enscript highlight=scheme>(daemon:ize)</enscript> This changes the current working directory to {{/}}, redirects {{stdin}}, {{stdout}} and {{stderr}} to {{/dev/null}}, {{fork()}}s and creates a new session. === Setting syslog options <enscript highlight=scheme>(daemon:openlog ident option facility)</enscript> Calls {{openlog(3)}} with the given {{ident}} (a string identifying the process or {{#f}}), {{option}} and {{facility}}. See {{openlog(3)}} for details. The following constants are available for {{option}}: {{daemon:LOG-CONS}}, {{daemon:LOG-NDELAY}}, {{daemon:LOG-NOWAIT}}, {{daemon:LOG-ODELAY}}, {{daemon:LOG-PID}}. They can be combined using {{bitwise-ior}}. The following constants are available for {{facility}}: {{daemon:LOG-AUTHPRIV}}, {{daemon:LOG-CRON}}, {{daemon:LOG-DAEMON}}, {{daemon:LOG-KERN}}, {{daemon:LOG-LOCAL0}}, {{daemon:LOG-LOCAL1}}, {{daemon:LOG-LOCAL2}}, {{daemon:LOG-LOCAL3}}, {{daemon:LOG-LOCAL4}}, {{daemon:LOG-LOCAL5}}, {{daemon:LOG-LOCAL6}}, {{daemon:LOG-LOCAL7}}, {{daemon:LOG-LPR}}, {{daemon:LOG-MAIL}}, {{daemon:LOG-NEWS}}, {{daemon:LOG-SYSLOG}}, {{daemon:LOG-USER}}, {{daemon:LOG-UUCP}}. As stated by {{openlog(3)}}, the use of {{daemon:openlog}} is optional. === Logging messages to syslog <enscript highlight=scheme>(daemon:syslog priority message args...)</enscript> Calls {{syslog(3)}} with the given {{priority}} and {{message}} (formatted using {{sprintf}}, so you can use {{~a}} and {{~s}} in {{message}}). The following constants are available for {{priority}}: {{daemon:LOG-EMERG}}, {{daemon:LOG-ALERT}}, {{daemon:LOG-CRIT}}, {{daemon:LOG-ERR}}, {{daemon:LOG-WARNING}}, {{daemon:LOG-NOTICE}}, {{daemon:LOG-INFO}}, {{daemon:LOG-DEBUG}}. === Version history ==== 1.0 * Initial release.
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you add 19 to 20?