From 758e570794bd2d891be0b8c1ee931c492b3ac627 Mon Sep 17 00:00:00 2001 From: pezcurrel Date: Sun, 8 Sep 2024 20:29:29 +0200 Subject: [PATCH] =?UTF-8?q?All=20values=20coming=20from=20=E2=80=9Cdate?= =?UTF-8?q?=E2=80=9D=20are=20now=20correctly=20converted=20to=20integers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/clitools/maintain/pcloop.bash | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/web/clitools/maintain/pcloop.bash b/web/clitools/maintain/pcloop.bash index dccf8dd..bd2e95a 100755 --- a/web/clitools/maintain/pcloop.bash +++ b/web/clitools/maintain/pcloop.bash @@ -1,4 +1,5 @@ #!/bin/bash + trap "exit" INT basedir=`dirname "$0"` cd "$basedir/.." @@ -7,17 +8,17 @@ mailmta=`cat "${mailcfgfp}" | grep -P '^mta=' | sed -e 's/^mta=//' -e 's/^"//' - mailfrom=`cat "${mailcfgfp}" | grep -P '^from=' | sed -e 's/^from=//' -e 's/^"//' -e 's/"$//'` mailto=`cat "${mailcfgfp}" | grep -P '^to=' | sed -e 's/^to=//' -e 's/^"//' -e 's/"$//'` subj="" -lastmailts=0 +lastmailts=$((0)) newmailwait=$((12*60*60)) resurrfp=".pcresurrectdone" cmdlogfp="peerscrawl.log" logfp="pcloop.log" -resdom=25 # day of month when (or after when, if it has not been done already) to execute peerscrawl.php with a gracetime of 2 months +resdom=$((25)) # day of month when (or after when, if it has not been done already) to execute peerscrawl.php with a gracetime of 2 months function log { echo `date "+%Y-%m-%d %H:%M:%S.%N"` "${1}" >> "${logfp}" } while true; do - dom=$((`date "+%d"`+0)) + dom=$(($(expr $(date "+%d") + 0))) [ $dom -lt $resdom -a -f "$resurrfp" ] && rm "$resurrfp" if [[ ($dom -ge $resdom ) && !(-f "$resurrfp") ]]; then # use a gracetime of 2 months touch "$resurrfp" @@ -31,11 +32,11 @@ while true; do tail $cmdlogfp >> $logfp log "### THE END ###" cp "$cmdlogfp" "${cmdlogfp}.old" - now=$((`date "+%s"`+0)) + now=$(($(expr $(date "+%s") + 0))) if [ $(($now-$lastmailts)) -gt $newmailwait ]; then [ $pcrv == "0" ] && subj="peerscrawl.php: tutto ok :-)" || subj="peerscrawl.php: uscito con errore: ${pcrv} :-(" tail $logfp | s-nail -s "${subj}" -S v15-compat -S from="${mailfrom}" -S smtp-use-starttls -S mta="${mailmta}" "${mailto}" - lastmailts=$((`date "+%s"`+0)) + lastmailts=$(($(expr $(date "+%s") + 0))) fi done exit 0;