diff options
| author | Paul Buetow <paul@buetow.org> | 2023-04-01 15:55:00 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-04-01 15:55:00 +0300 |
| commit | 3492c68d239854c0404fe77a00460eeedd41f5cc (patch) | |
| tree | 75d77d1a86869032cade9e2a17f6312bba761e98 /gemfeed/2011-05-07-perl-daemon-service-framework.html | |
| parent | cca259cdb780316a2d636039709a90a44590156d (diff) | |
Update content for html
Diffstat (limited to 'gemfeed/2011-05-07-perl-daemon-service-framework.html')
| -rw-r--r-- | gemfeed/2011-05-07-perl-daemon-service-framework.html | 55 |
1 files changed, 15 insertions, 40 deletions
diff --git a/gemfeed/2011-05-07-perl-daemon-service-framework.html b/gemfeed/2011-05-07-perl-daemon-service-framework.html index 31ed4fac..4a61e175 100644 --- a/gemfeed/2011-05-07-perl-daemon-service-framework.html +++ b/gemfeed/2011-05-07-perl-daemon-service-framework.html @@ -9,20 +9,16 @@ </head> <body> <h1>Perl Daemon (Service Framework)</h1> -<span class="quote"><i>Published at 2011-05-07T22:26:02+01:00; Updated at 2021-05-07</i></span><br /> -<br /> +<p class="quote"><i>Published at 2011-05-07T22:26:02+01:00; Updated at 2021-05-07</i></p> <pre> a'! _,,_ a'! _,,_ a'! _,,_ \\_/ \ \\_/ \ \\_/ \.-, \, /-( /'-,\, /-( /'-, \, /-( / //\ //\\ //\ //\\ //\ //\\jrei </pre> -<br /> -PerlDaemon is a minimal daemon for Linux and other Unix like operating systems programmed in Perl. It is a minimal but pretty functional and fairly generic service framework. This means that it does not do anything useful other than providing a framework for starting, stopping, configuring and logging. To do something useful, a module (written in Perl) must be provided.<br /> -<br /> +<p>PerlDaemon is a minimal daemon for Linux and other Unix like operating systems programmed in Perl. It is a minimal but pretty functional and fairly generic service framework. This means that it does not do anything useful other than providing a framework for starting, stopping, configuring and logging. To do something useful, a module (written in Perl) must be provided.</p> <h2>Features</h2> -PerlDaemon supports:<br /> -<br /> +<p>PerlDaemon supports:</p> <ul> <li>Automatic daemonizing</li> <li>Logging</li> @@ -33,7 +29,6 @@ PerlDaemon supports:<br /> <li>Easy to extend</li> <li>Multi-instance support (just use a different directory for each instance).</li> </ul> -<br /> <h2>Quick Guide</h2> <pre> # Starting @@ -45,12 +40,9 @@ PerlDaemon supports:<br /> # Alternatively: Starting in foreground ./bin/perldaemon start daemon.daemonize=no (or shortcut ./control foreground) </pre> -<br /> -To stop a daemon from running in foreground mode, "Ctrl+C" must be hit. To see more available startup options run "./control" without any argument.<br /> -<br /> +<p>To stop a daemon from running in foreground mode, "Ctrl+C" must be hit. To see more available startup options run "./control" without any argument.</p> <h2>How to configure</h2> -The daemon instance can be configured in "./conf/perldaemon.conf". If you want to change a property only once, it is also possible to specify it on the command line (which will take precedence over the config file). All available config properties can be displayed via "./control keys":<br /> -<br /> +<p>The daemon instance can be configured in "./conf/perldaemon.conf". If you want to change a property only once, it is also possible to specify it on the command line (which will take precedence over the config file). All available config properties can be displayed via "./control keys":</p> <pre> pb@titania:~/svn/utils/perldaemon/trunk$ ./control keys # Path to the logfile @@ -77,10 +69,8 @@ daemon.alivefile=./run/perldaemon.alive # Specifies the working directory daemon.wd=./ </pre> -<br /> <h2>Example </h2> -So let's start the daemon with a loop interval of 10 seconds:<br /> -<br /> +<p>So let's start the daemon with a loop interval of 10 seconds:</p> <pre> $ ./control keys | grep daemon.loopinterval daemon.loopinterval=1 @@ -94,20 +84,15 @@ Mon Jun 13 11:29:27 2011 (PID 2838): ExampleModule Test 2 $ ./control stop Stopping daemon now... </pre> -<br /> -If you want to change that property forever, either edit perldaemon.conf or do this:<br /> -<br /> +<p>If you want to change that property forever, either edit perldaemon.conf or do this:</p> <pre> $ ./control keys daemon.loopinterval=10 > new.conf; mv new.conf conf/perldaemon.conf </pre> -<br /> <h2>HiRes event loop</h2> -PerlDaemon uses <span class="inlinecode">Time::HiRes</span> to make sure that all the events run incorrect intervals. For each loop run, a time carry value is recorded and added to the next loop run to catch up on lost time.<br /> -<br /> +<p>PerlDaemon uses <span class="inlinecode">Time::HiRes</span> to make sure that all the events run incorrect intervals. For each loop run, a time carry value is recorded and added to the next loop run to catch up on lost time.</p> <h2>Writing your own modules</h2> <h3>Example module</h3> -This is one of the example modules you will find in the source code. It should be pretty self-explanatory if you know Perl :-).<br /> -<br /> +<p>This is one of the example modules you will find in the source code. It should be pretty self-explanatory if you know Perl :-).</p> <pre> package PerlDaemonModules::ExampleModule; @@ -139,10 +124,8 @@ sub do ($) { 1; </pre> -<br /> <h3>Your own module</h3> -Want to give it some better use? It's just as easy as:<br /> -<br /> +<p>Want to give it some better use? It's just as easy as:</p> <pre> cd ./lib/PerlDaemonModules/ cp ExampleModule.pm YourModule.pm @@ -150,24 +133,16 @@ Want to give it some better use? It's just as easy as:<br /> cd - ./bin/perldaemon restart (or shortcurt ./control restart) </pre> -<br /> -Now watch <span class="inlinecode">./log/perldaemon.log</span> closely. It is a good practice to test your modules in 'foreground mode' (see above how to do that).<br /> -<br /> -BTW: You can install as many modules within the same instance as desired. But they are run in sequential order (in future, they can also run in parallel using several threads or processes).<br /> -<br /> +<p>Now watch <span class="inlinecode">./log/perldaemon.log</span> closely. It is a good practice to test your modules in 'foreground mode' (see above how to do that).</p> +<p>BTW: You can install as many modules within the same instance as desired. But they are run in sequential order (in future, they can also run in parallel using several threads or processes).</p> <h2>May the source be with you</h2> -You can find PerlDaemon (including the examples) at:<br /> -<br /> +<p>You can find PerlDaemon (including the examples) at:</p> <a class="textlink" href="https://codeberg.org/snonux/perldaemon">https://codeberg.org/snonux/perldaemon</a><br /> -<br /> -Other related posts are:<br /> -<br /> +<p>Other related posts are:</p> <a class="textlink" href="./2022-05-27-perl-is-still-a-great-choice.html">2022-05-27 Perl is still a great choice</a><br /> <a class="textlink" href="./2011-05-07-perl-daemon-service-framework.html">2011-05-07 Perl Daemon (Service Framework) (You are currently reading this)</a><br /> <a class="textlink" href="./2008-06-26-perl-poetry.html">2008-06-26 Perl Poetry</a><br /> -<br /> -E-Mail your comments to hi@paul.cyou :-)<br /> -<br /> +<p>E-Mail your comments to hi@paul.cyou :-)</p> <a class="textlink" href="../">Back to the main site</a><br /> <p class="footer"> Generated with <a href="https://codeberg.org/snonux/gemtexter">Gemtexter</a> | |
