diff options
| author | Paul Buetow <paul@buetow.org> | 2022-04-21 23:31:45 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2022-04-21 23:31:45 +0200 |
| commit | 70a177bfab34c1ea5146a33ec718e9db77fa20d6 (patch) | |
| tree | bfb460d7e5b25d86d43d02b13202fed62d4f648f | |
| parent | f5f29f37dd40b5446acdd59629c604af62bf8e56 (diff) | |
Make PerlDaemon run on OpenBSD 7.1
| -rwxr-xr-x | control | 24 | ||||
| -rw-r--r-- | lib/PerlDaemon/Logger.pm | 3 | ||||
| -rw-r--r-- | lib/PerlDaemon/RunModules.pm | 2 |
3 files changed, 12 insertions, 17 deletions
@@ -1,12 +1,12 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh # PerlDaemon (c) 2010, 2011, 2015 Dipl.-Inform. (FH) Paul Buetow (http://perldaemon.buetow.org) -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 +for libpath in $LIBPATHS; do + if [ -f $libpath/PerlDaemon/PerlDaemon.pl ]; then + LIBDIR=$libpath break fi done @@ -16,26 +16,26 @@ if [ -z "$LIBDIR" ]; then exit 1 fi -start () { +function start { echo Starting daemon now... perl -I$LIBDIR $LIBDIR/PerlDaemon/PerlDaemon.pl config=./conf/perldaemon.conf $@ } -stop () { +function stop { if [ -f ./run/perldaemon.pid ]; then - echo Stopping daemon now... - kill $(cat ./run/perldaemon.pid); + echo "Stopping daemon now..." + kill `cat ./run/perldaemon.pid`; else echo "No pidfile found (not running?) " fi } -logrotate () { +function logrotate { echo Triggering a logrotate kill -HUP $(cat ./run/perldaemon.pid) } -keys () { +function keys { perl -I$LIBDIR $LIBDIR/PerlDaemon/PerlDaemon.pl config=./conf/perldaemon.conf keys=1 $@ } diff --git a/lib/PerlDaemon/Logger.pm b/lib/PerlDaemon/Logger.pm index 52b5eb7..7285588 100644 --- a/lib/PerlDaemon/Logger.pm +++ b/lib/PerlDaemon/Logger.pm @@ -2,8 +2,6 @@ package PerlDaemon::Logger; use strict; use warnings; -use threads; -use threads::shared; use Shell qw(mv); use POSIX qw(strftime); @@ -23,7 +21,6 @@ sub new ($$) { $SELF = bless { conf => $conf }, $class; $SELF->{queue} = []; - share $SELF->{queue}; return $SELF; } diff --git a/lib/PerlDaemon/RunModules.pm b/lib/PerlDaemon/RunModules.pm index 1b6b486..147325a 100644 --- a/lib/PerlDaemon/RunModules.pm +++ b/lib/PerlDaemon/RunModules.pm @@ -4,7 +4,6 @@ package PerlDaemon::RunModules; use strict; use warnings; -use threads qw(exit stringify); use Time::HiRes qw(gettimeofday tv_interval); sub new ($$) { @@ -82,7 +81,6 @@ sub do ($) { $scheduler->{$k}{lastrun} = $now; $v->do(); - } } } |
