Re: daemon server using perl

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

 



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       ncherry@xxxxxxxxxxx
http://www.linuxha.com/                         Main site
http://linuxha.blogspot.com/                    My HA Blog
Author of:    	Linux Smart Homes For Dummies

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux