Re: daemon server using perl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2007-09-27 at 22:07 -0400, Neil Cherry wrote:
> Gregory P. Ennis wrote:
> > Everyone,
> > 
> > I would like to create a daemon server that could be used like sendmail,
> > dovecot etc.  I would like it to monitor a specified port for queries
> > from a local network, and pass the queries to a database that is not
> > mysql or postgresql, and return the results to the same port,  
> > 
> > I do not  have experience in C so I would prefer to use perl.  
> > 
> > Can anyone point me to a tutorial?
> 
> I don't have a tutorial but this should help:
> 
> # OK Here is were I need to daemonize this program. (NJC)
> #
> #     * Open /dev/tty and use the the TIOCNOTTY ioctl on it. See tty(4)
> #       for details. Or better yet, you can just use the POSIX::setsid()
> #       function, so you don't have to worry about process groups.
> #     * Change directory to /
> #     * Background yourself like this:
> 
>      setsid() || die "Can't start a new session: $!";
>      chdir("/");
>      fork && exit;
> 
> Then open your network ports and proceed to listen.
> 
> You might also want to use a search engine for "Perl daemon" you'll
> find links like this:
> 
> http://search.cpan.org/~ehood/Proc-Daemon-0.03/Daemon.pm
> 
> -- 
> Linux Home Automation         Neil Cherry       [email protected]

Neil,

Thanks for the information.  Looks like what I want to do is possible!!!

Greg


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux