diff options
| author | Paul Buetow <paul@buetow.org> | 2023-04-07 00:49:19 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-04-07 00:49:19 +0300 |
| commit | 30fc4e8f74315a92aaec36dfb9a8d4efa0a21791 (patch) | |
| tree | 97ef2b26fd54a366d72f5289ba11ea311f8a0173 /gemfeed/2011-05-07-perl-daemon-service-framework.html | |
| parent | 5c9e3886de0f9041e4a6fb6fea9917e29a8fbd76 (diff) | |
exact style
Diffstat (limited to 'gemfeed/2011-05-07-perl-daemon-service-framework.html')
| -rw-r--r-- | gemfeed/2011-05-07-perl-daemon-service-framework.html | 96 |
1 files changed, 65 insertions, 31 deletions
diff --git a/gemfeed/2011-05-07-perl-daemon-service-framework.html b/gemfeed/2011-05-07-perl-daemon-service-framework.html index 4a61e175..c7f53f11 100644 --- a/gemfeed/2011-05-07-perl-daemon-service-framework.html +++ b/gemfeed/2011-05-07-perl-daemon-service-framework.html @@ -8,17 +8,23 @@ <link rel="stylesheet" href="style-override.css" /> </head> <body> -<h1>Perl Daemon (Service Framework)</h1> -<p class="quote"><i>Published at 2011-05-07T22:26:02+01:00; Updated at 2021-05-07</i></p> +<h1 style='display: inline'>Perl Daemon (Service Framework)</h1><br /> +<br /> +<span class=quote>Published at 2011-05-07T22:26:02+01:00; Updated at 2021-05-07</span><br /> +<br /> <pre> a'! _,,_ a'! _,,_ a'! _,,_ \\_/ \ \\_/ \ \\_/ \.-, \, /-( /'-,\, /-( /'-, \, /-( / //\ //\\ //\ //\\ //\ //\\jrei </pre> -<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> -<p>PerlDaemon supports:</p> +<br /> +<span>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.</span><br /> +<br /> +<h2 style='display: inline'>Features</h2><br /> +<br /> +<span>PerlDaemon supports:</span><br /> +<br /> <ul> <li>Automatic daemonizing</li> <li>Logging</li> @@ -28,8 +34,9 @@ <li>Easy to configure</li> <li>Easy to extend</li> <li>Multi-instance support (just use a different directory for each instance).</li> -</ul> -<h2>Quick Guide</h2> +</ul><br /> +<h2 style='display: inline'>Quick Guide</h2><br /> +<br /> <pre> # Starting ./bin/perldaemon start (or shortcut ./control start) @@ -40,9 +47,13 @@ # Alternatively: Starting in foreground ./bin/perldaemon start daemon.daemonize=no (or shortcut ./control foreground) </pre> -<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> -<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> +<br /> +<span>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.</span><br /> +<br /> +<h2 style='display: inline'>How to configure</h2><br /> +<br /> +<span>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":</span><br /> +<br /> <pre> pb@titania:~/svn/utils/perldaemon/trunk$ ./control keys # Path to the logfile @@ -69,8 +80,11 @@ daemon.alivefile=./run/perldaemon.alive # Specifies the working directory daemon.wd=./ </pre> -<h2>Example </h2> -<p>So let's start the daemon with a loop interval of 10 seconds:</p> +<br /> +<h2 style='display: inline'>Example </h2><br /> +<br /> +<span>So let's start the daemon with a loop interval of 10 seconds:</span><br /> +<br /> <pre> $ ./control keys | grep daemon.loopinterval daemon.loopinterval=1 @@ -84,15 +98,23 @@ Mon Jun 13 11:29:27 2011 (PID 2838): ExampleModule Test 2 $ ./control stop Stopping daemon now... </pre> -<p>If you want to change that property forever, either edit perldaemon.conf or do this:</p> +<br /> +<span>If you want to change that property forever, either edit perldaemon.conf or do this:</span><br /> +<br /> <pre> $ ./control keys daemon.loopinterval=10 > new.conf; mv new.conf conf/perldaemon.conf </pre> -<h2>HiRes event loop</h2> -<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> -<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> +<br /> +<h2 style='display: inline'>HiRes event loop</h2><br /> +<br /> +<span>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.</span><br /> +<br /> +<h2 style='display: inline'>Writing your own modules</h2><br /> +<br /> +<h3 style='display: inline'>Example module</h3><br /> +<br /> +<span>This is one of the example modules you will find in the source code. It should be pretty self-explanatory if you know Perl :-).</span><br /> +<br /> <pre> package PerlDaemonModules::ExampleModule; @@ -124,8 +146,11 @@ sub do ($) { 1; </pre> -<h3>Your own module</h3> -<p>Want to give it some better use? It's just as easy as:</p> +<br /> +<h3 style='display: inline'>Your own module</h3><br /> +<br /> +<span>Want to give it some better use? It's just as easy as:</span><br /> +<br /> <pre> cd ./lib/PerlDaemonModules/ cp ExampleModule.pm YourModule.pm @@ -133,17 +158,26 @@ sub do ($) { cd - ./bin/perldaemon restart (or shortcurt ./control restart) </pre> -<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> -<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 /> -<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 /> -<p>E-Mail your comments to hi@paul.cyou :-)</p> -<a class="textlink" href="../">Back to the main site</a><br /> +<br /> +<span>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).</span><br /> +<br /> +<span>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).</span><br /> +<br /> +<h2 style='display: inline'>May the source be with you</h2><br /> +<br /> +<span>You can find PerlDaemon (including the examples) at:</span><br /> +<br /> +<a class=textlink href='https://codeberg.org/snonux/perldaemon'>https://codeberg.org/snonux/perldaemon</a><br /> +<br /> +<span>Other related posts are:</span><br /> +<br /> +<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 /> +<span>E-Mail your comments to hi@paul.cyou :-)</span><br /> +<br /> +<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> | served by <a href="https://www.OpenBSD.org">OpenBSD</a>/<a href="https://man.openbsd.org/httpd.8">httpd(8)</a> | |
