diff options
| author | admin (centauri.fritz.box) <puppet@mx.buetow.org> | 2014-03-22 12:11:29 +0100 |
|---|---|---|
| committer | admin (centauri.fritz.box) <puppet@mx.buetow.org> | 2014-03-22 12:11:29 +0100 |
| commit | d6f78c532c2c23b1203b1c0332de89a8c8c53d04 (patch) | |
| tree | 1c8e9fd2b62dfd85667d55a4794af09ce69353a2 | |
| parent | 439c2091704a897eb43761fe9371c3400d42a4ea (diff) | |
change git repo
| -rwxr-xr-x[l---------] | control | 75 |
1 files changed, 74 insertions, 1 deletions
@@ -1 +1,74 @@ -bin/perldaemon
\ No newline at end of file +#!/usr/bin/env bash +# PerlDaemon (c) 2010, 2011, 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) + +for path in ${LIBPATHS[@]}; do + if [ -f $path/PerlDaemon/PerlDaemon.pl ]; then + LIBDIR=$path + break + fi +done + +if [ -z "$LIBDIR" ]; then + 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 $@ +} + +stop () { + 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) +} + +keys () { + perl -I$LIBDIR $LIBDIR/PerlDaemon/PerlDaemon.pl config=./conf/perldaemon.conf keys=1 $@ +} + +case $ARG in + start) + shift + start $@ + ;; + + stop) + stop + ;; + + restart) + shift + stop + start $@ + ;; + + logrotate) + logrotate + ;; + + foreground) + start daemon.daemonize=no $@ + ;; + + keys) + keys $@ + ;; + + *) + echo "Usage: $0 <start|stop|restart|logrotate|foreground|keys> [key1=val1 [[key2=val2] ...]]" + exit 1 + ;; +esac |
