Skip to content

Commit

Permalink
add config var HOOKDIR
Browse files Browse the repository at this point in the history
  • Loading branch information
axelhahn committed Jul 31, 2023
1 parent c6f4191 commit 250d57f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions cronwrapper.cfg.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -----------------------------------------------------------------------------
# CRONWRAPPER * config
# see https://www.axel-hahn.de/docs/cronwrapper/Configuration.html
# -----------------------------------------------------------------------------

# ----- shared values:
Expand All @@ -10,8 +11,13 @@ LOGDIR=/var/tmp/cronlogs
# deny multiple execution of the same job? set 0 or 1
SINGLEJOB=1

# directory with hooks
HOOKDIR=./hooks


# ----- for sync of local logs
# see https://www.axel-hahn.de/docs/cronwrapper/Usage/Cronlog_Sync.html

TOUCHFILE=lastsync
[email protected]:/var/tmp/allcronlogs/$( hostname -f )
SSHKEY=/root/.ssh/[email protected]
Expand Down
5 changes: 3 additions & 2 deletions cronwrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ TOUCHPART="_flag-${LABELSTR}_expire_"

LOGFILE=/tmp/call_any_script_$$.log
LOGDIR="/var/tmp/cronlogs"
HOOKDIR=./hooks
MYHOST=$( hostname -f )

# --- log executions of the whole day
Expand Down Expand Up @@ -139,7 +140,7 @@ function w() {
function runHooks(){
local _hookbase="$1"
local _exitcode="$2"
local _hookdir; _hookdir="$( dirname $0 )/hooks/$_hookbase"
local _hookdir; _hookdir="${HOOKDIR}/$_hookbase"

if [ -z "$_exitcode" ]; then
_hookdir="$_hookdir/always"
Expand Down Expand Up @@ -174,7 +175,7 @@ test -f "$( dirname $0)/cronwrapper.env" && . $( dirname $0)/cronwrapper.env
test -f "$( dirname $0)/cronwrapper.cfg" && . $( dirname $0)/cronwrapper.cfg
. $( dirname $0)/inc_cronfunctions.sh


HOOKDIR=${HOOKDIR/./$( dirname $0 )}
FINALOUTFILE="$LOGDIR/${MYHOST}_${LABELSTR}.log"
JOBLOG="$LOGDIR/${JOBBLOGBASE}$(date +%a).done"
OUTFILEBASE="$FINALOUTFILE.running"
Expand Down

0 comments on commit 250d57f

Please sign in to comment.