Made it run peerscrawl.php with a gracetime of 1 year once after the 26th of the month; minor changes

This commit is contained in:
pezcurrel 2023-01-06 17:08:07 +01:00
parent 2c66514b37
commit 0be17601f8

View file

@ -2,9 +2,25 @@
trap "exit" INT
basedir=`dirname "$0"`
cd "$basedir/.."
donefp=".pcresurrectdone"
cmdlogfp="peerscrawl.log"
logfp="pcloop.log"
resdom=26
function log {
echo `date "+%Y-%m-%d %H:%M:%S.%N"` "${1}" >> "${logfp}"
}
while true; do
./peerscrawl.php -e peerscrawl.exclude -E &> peerscrawl.log
tail peerscrawl.log >> pcloop.log
echo "### END ###" >> pcloop.log
dom=$((`date "+%d"`+0))
[ $dom -lt $resdom -a -f "$donefp" ] && rm "$donefp"
if [[ ($dom -ge $resdom ) && !(-f "$donefp") ]]; then # usa un gracetime di 1 anno
touch "$donefp"
log "### Eseguo peerscrawl.php con un gracetime di 1 anno ###"
./peerscrawl.php -g 1y -e peerscrawl.exclude &> $cmdlogfp
else # use il gracetime di default
log "### Eseguo peerscrawl.php con il gracetime di default ###"
./peerscrawl.php -e peerscrawl.exclude &> $cmdlogfp
fi
tail $cmdlogfp >> $logfp
log "### Fine ###"
done
exit 0;