Skip to content

Commit

Permalink
update help; change joblogs syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
axelhahn committed Mar 5, 2024
1 parent 649e694 commit b070290
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions cronwrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,11 @@ $( printf "%76s" "v $_version" )
$line1
$(test -n "$1" && ( cw.color error; echo "$1"; cw.color reset; echo; echo ))
..... $( cw.emoji "" )SYNTAX:
$(cw.helpsection "" "SYNTAX")
$0 TTL COMMAND [LABEL]
..... $( cw.emoji "🏷️" )PRAMETERS:
$(cw.helpsection "🏷️" "PRAMETERS")
TTL integer value in [min]
This value says how often your cronjob runs. It is used to verify
Expand All @@ -118,16 +117,14 @@ $(test -n "$1" && ( cw.color error; echo "$1"; cw.color reset; echo; echo ))
When you start a script with different parameters it is highly
recommended to set the label.
..... $( cw.emoji "📝" )REMARK:
$(cw.helpsection "📝" "REMARK")
You don't need to redirect the output in a cron config file. STDOUT and
STDERR will be fetched automaticly.
It also means: Generate as much output as you want and want to have to debug
a job in error cases.
..... $( cw.emoji "🗨️" )MORE TO SAY:
$(cw.helpsection "🗨️" "MORE TO SAY")
The output directory of all jobs executed by $0 is
${CW_LOGDIR}.
Expand Down Expand Up @@ -216,7 +213,8 @@ test -f "${CW_DIRSELF}/cronwrapper.cfg" && . "${CW_DIRSELF}/cronwrapper.cfg"

CW_HOOKDIR=${CW_HOOKDIR/./$( dirname $0 )}
CW_FINALOUTFILE="$CW_LOGDIR/${CW_MYHOST}_${CW_LABELSTR}.log"
CW_JOBLOG="$CW_LOGDIR/${CW_JOBBLOGBASE}$(date +%a).done"
CW_JOBLOG="$CW_LOGDIR/${CW_JOBBLOGBASE}$(date +%Y%m%d-%a).done"
CW_KEEPDAYS=14
CW_OUTFILEBASE="$CW_FINALOUTFILE.running"
CW_OUTFILE="$CW_OUTFILEBASE.$$"

Expand Down Expand Up @@ -355,7 +353,7 @@ w "REM $line1"
# write a log for execution of a cronjob
echo "job=${CW_LABELSTR}:host=$CW_MYHOST:start=$CW_TIMER_START:end=$CW_TIMER_END:exectime=$iExectime:ttl=${TTL}:rc=$rc" >>"$CW_JOBLOG"
chmod 777 "$CW_JOBLOG" 2>/dev/null
find $CW_LOGDIR -name "${CW_JOBBLOGBASE}*" -type f -mtime +4 -exec rm -f {} \;
find $CW_LOGDIR -name "${CW_JOBBLOGBASE}*" -type f -mtime +$CW_KEEPDAYS -exec rm -f {} \;

runHooks "after" $rc >>"${CW_LOGFILE}" 2>&1

Expand Down

0 comments on commit b070290

Please sign in to comment.