diff options
| author | Paul Buetow <paul@buetow.org> | 2022-04-21 23:45:23 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2022-04-21 22:59:05 +0100 |
| commit | ce255ff5a1257db57424603caac2b4bfca3c7694 (patch) | |
| tree | 9f5c3a9222555270ae7d3ebccd2d4da27e3f1e87 | |
| parent | db2bf4b9dbe3388e074a1144ac3f0e9b04d43b96 (diff) | |
release v1.3develop
| -rw-r--r-- | CHANGELOG | 4 | ||||
| -rw-r--r-- | COPYING | 4 | ||||
| -rw-r--r-- | VERSION | 2 | ||||
| -rw-r--r-- | WISHLIST | 2 | ||||
| -rwxr-xr-x | bin/perldaemon | 101 | ||||
| l---------[-rwxr-xr-x] | control | 75 | ||||
| -rw-r--r-- | lib/PerlDaemon/Logger.pm | 3 | ||||
| -rw-r--r-- | lib/PerlDaemon/PerlDaemon.pl | 6 | ||||
| -rw-r--r-- | lib/PerlDaemon/RunModules.pm | 2 | ||||
| -rw-r--r-- | lib/PerlDaemonModules/ExampleModule.pm | 7 | ||||
| -rw-r--r-- | lib/PerlDaemonModules/ExampleModule2.pm | 7 |
11 files changed, 63 insertions, 150 deletions
@@ -1,3 +1,7 @@ +Thu Apr 21 22:32:30 CET 2022 +* Released PerlDaemon v1.3 +* Make it run without the need of external dependencies on OpenBSD 7.1. + Sat Nov 19 22:32:30 CET 2011 * Released PerlDaemon v1.2.1 @@ -1,6 +1,6 @@ -# PerlDaemon (c) 2010, 2011, Dipl.-Inform. (FH) Paul Buetow +# PerlDaemon (c) 2010, 2011, 2015, 2022 Paul Buetow # -# E-Mail: perldaemon@dev.buetow.org WWW: http://perldaemon.buetow.org +# E-Mail: perldaemon@dev.buetow.org WWW: http://paul.buetow.org # # All rights reserved. # @@ -1 +1 @@ -PerlDaemon v1.2.1-master +PerlDaemon v1.3 @@ -1,5 +1,3 @@ * Add parallel module execution support (threads or forks) * Add special signal handling (e.g. trigger modules) * Allow to enable/disable time carry calculation -* Debian/Ubuntu .debs - diff --git a/bin/perldaemon b/bin/perldaemon index 11c1a7e..6fb2b2c 100755 --- a/bin/perldaemon +++ b/bin/perldaemon @@ -1,74 +1,73 @@ -#!/usr/bin/env bash -# PerlDaemon (c) 2010, 2011, Dipl.-Inform. (FH) Paul Buetow (http://perldaemon.buetow.org) +#!/usr/bin/env sh -declare -r ARG=$1 -declare -a LIBPATHS=(./lib ../lib /lib /usr/lib /usr/local/lib /opt/lib) +export ARG=$1 +export LIBPATHS="./lib ../lib /lib /usr/lib /usr/local/lib /opt/lib" -for path in ${LIBPATHS[@]}; do - if [ -f $path/PerlDaemon/PerlDaemon.pl ]; then - LIBDIR=$path - break - fi +for libpath in $LIBPATHS; do + if [ -f $libpath/PerlDaemon/PerlDaemon.pl ]; then + LIBDIR=$libpath + break + fi done if [ -z "$LIBDIR" ]; then - echo No PerlDaemon module path found - exit 1 + echo No PerlDaemon module path found + exit 1 fi -start () { - echo Starting daemon now... - perl -I$LIBDIR $LIBDIR/PerlDaemon/PerlDaemon.pl config=./conf/perldaemon.conf $@ +function start_it { + echo Starting daemon now... + perl -I$LIBDIR $LIBDIR/PerlDaemon/PerlDaemon.pl config=./conf/perldaemon.conf $@ } -stop () { - if [ -f ./run/perldaemon.pid ]; then - echo Stopping daemon now... - kill $(cat ./run/perldaemon.pid); - else - echo "No pidfile found (not running?) " - fi +function stop_it { + if [ -f ./run/perldaemon.pid ]; then + echo "Stopping daemon now..." + kill `cat ./run/perldaemon.pid`; + else + echo "No pidfile found (not running?) " + fi } -logrotate () { - echo Triggering a logrotate - kill -HUP $(cat ./run/perldaemon.pid) +function logrotate_it { + echo Triggering a logrotate + kill -HUP $(cat ./run/perldaemon.pid) } -keys () { - perl -I$LIBDIR $LIBDIR/PerlDaemon/PerlDaemon.pl config=./conf/perldaemon.conf keys=1 $@ +function keys { + perl -I$LIBDIR $LIBDIR/PerlDaemon/PerlDaemon.pl config=./conf/perldaemon.conf keys=1 $@ } case $ARG in - start) - shift - start $@ - ;; + start) + shift + start_it $@ + ;; - stop) - stop - ;; + stop) + stop_it + ;; - restart) - shift - stop - start $@ - ;; + restart) + shift + stop_it + start_it $@ + ;; - logrotate) - logrotate - ;; + logrotate) + logrotate_it + ;; - foreground) - start daemon.daemonize=no $@ - ;; + foreground) + start_it daemon.daemonize=no $@ + ;; - keys) - keys $@ - ;; + keys) + keys $@ + ;; - *) - echo "Usage: $0 <start|stop|restart|logrotate|foreground|keys> [key1=val1 [[key2=val2] ...]]" - exit 1 - ;; + *) + echo "Usage: $0 <start|stop|restart|logrotate|foreground|keys> [key1=val1 [[key2=val2] ...]]" + exit 1 + ;; esac @@ -1,74 +1 @@ -#!/usr/bin/env sh -# PerlDaemon (c) 2010, 2011, 2015 Dipl.-Inform. (FH) Paul Buetow (http://perldaemon.buetow.org) - -export ARG=$1 -export LIBPATHS="./lib ../lib /lib /usr/lib /usr/local/lib /opt/lib" - -for libpath in $LIBPATHS; do - if [ -f $libpath/PerlDaemon/PerlDaemon.pl ]; then - LIBDIR=$libpath - break - fi -done - -if [ -z "$LIBDIR" ]; then - echo No PerlDaemon module path found - exit 1 -fi - -function start_it { - echo Starting daemon now... - perl -I$LIBDIR $LIBDIR/PerlDaemon/PerlDaemon.pl config=./conf/perldaemon.conf $@ -} - -function stop_it { - if [ -f ./run/perldaemon.pid ]; then - echo "Stopping daemon now..." - kill `cat ./run/perldaemon.pid`; - else - echo "No pidfile found (not running?) " - fi -} - -function logrotate_it { - echo Triggering a logrotate - kill -HUP $(cat ./run/perldaemon.pid) -} - -function keys { - perl -I$LIBDIR $LIBDIR/PerlDaemon/PerlDaemon.pl config=./conf/perldaemon.conf keys=1 $@ -} - -case $ARG in - start) - shift - start_it $@ - ;; - - stop) - stop_it - ;; - - restart) - shift - stop_it - start_it $@ - ;; - - logrotate) - logrotate_it - ;; - - foreground) - start_it daemon.daemonize=no $@ - ;; - - keys) - keys $@ - ;; - - *) - echo "Usage: $0 <start|stop|restart|logrotate|foreground|keys> [key1=val1 [[key2=val2] ...]]" - exit 1 - ;; -esac +bin/perldaemon
\ No newline at end of file diff --git a/lib/PerlDaemon/Logger.pm b/lib/PerlDaemon/Logger.pm index a5d632d..0cf9c65 100644 --- a/lib/PerlDaemon/Logger.pm +++ b/lib/PerlDaemon/Logger.pm @@ -18,7 +18,6 @@ sub new ($$) { die "Instance already exists" if defined $SELF; $SELF = bless { conf => $conf }, $class; - $SELF->{queue} = []; return $SELF; @@ -29,13 +28,11 @@ sub logmsg ($$) { my $conf = $self->{conf}; my $logline = localtime()." (PID $$): $msg\n"; - { lock $self->{queue}; push @{$self->{queue}}, $logline; } $self->flushlogs(); - return undef; } diff --git a/lib/PerlDaemon/PerlDaemon.pl b/lib/PerlDaemon/PerlDaemon.pl index af848dc..3f5765a 100644 --- a/lib/PerlDaemon/PerlDaemon.pl +++ b/lib/PerlDaemon/PerlDaemon.pl @@ -1,7 +1,5 @@ #!/usr/bin/perl -# PerlDaemon (c) 2010, 2011, Dipl.-Inform. (FH) Paul Buetow (http://perldaemon.buetow.org) - use strict; use warnings; @@ -166,7 +164,7 @@ sub daemonloop ($) { my $timediff = tv_interval($lastrun, $now); if ($timediff >= $loopinterval) { - $lastrun = $now; + $lastrun = $now; $rmodule->do(); alive $conf; } @@ -218,5 +216,3 @@ if ($conf->{'daemon.daemonize'} ne 'yes') { sighandlers $conf; daemonloop $conf; - - diff --git a/lib/PerlDaemon/RunModules.pm b/lib/PerlDaemon/RunModules.pm index 147325a..8caf858 100644 --- a/lib/PerlDaemon/RunModules.pm +++ b/lib/PerlDaemon/RunModules.pm @@ -1,5 +1,3 @@ -# PerlDaemon (c) 2010, 2011, 2015, Dipl.-Inform. (FH) Paul Buetow (http://perldaemon.buetow.org) - package PerlDaemon::RunModules; use strict; diff --git a/lib/PerlDaemonModules/ExampleModule.pm b/lib/PerlDaemonModules/ExampleModule.pm index 8e61f12..1c0e671 100644 --- a/lib/PerlDaemonModules/ExampleModule.pm +++ b/lib/PerlDaemonModules/ExampleModule.pm @@ -1,5 +1,3 @@ -# PerlDaemon (c) 2010, 2011, 2015, Dipl.-Inform. (FH) Paul Buetow (http://perldaemon.buetow.org) - package PerlDaemonModules::ExampleModule; use strict; @@ -9,9 +7,8 @@ sub new ($$$) { my ($class, $conf) = @_; my $self = bless { conf => $conf }, $class; - - # Store some private persistent module stuff - $self->{counter} = 0; + # Store some private persistent module stuff + $self->{counter} = 0; return $self; } diff --git a/lib/PerlDaemonModules/ExampleModule2.pm b/lib/PerlDaemonModules/ExampleModule2.pm index eaa5702..81b663b 100644 --- a/lib/PerlDaemonModules/ExampleModule2.pm +++ b/lib/PerlDaemonModules/ExampleModule2.pm @@ -1,5 +1,3 @@ -# PerlDaemon (c) 2010, 2011, 2015, Dipl.-Inform. (FH) Paul Buetow (http://perldaemon.buetow.org) - package PerlDaemonModules::ExampleModule2; use strict; @@ -9,9 +7,8 @@ sub new ($$$) { my ($class, $conf) = @_; my $self = bless { conf => $conf }, $class; - - # Store some private persistent module stuff - $self->{counter} = 0; + # Store some private persistent module stuff + $self->{counter} = 0; return $self; } |
