2022-12-25 11:43:30 +01:00
|
|
|
#!/bin/bash
|
2022-12-25 11:32:49 +01:00
|
|
|
trap "exit" INT
|
|
|
|
basedir=`dirname "$0"`
|
|
|
|
cd "$basedir/.."
|
2023-12-29 10:01:16 +01:00
|
|
|
resurrfp=".pcresurrectdone"
|
2023-01-06 17:08:07 +01:00
|
|
|
cmdlogfp="peerscrawl.log"
|
|
|
|
logfp="pcloop.log"
|
2024-02-25 08:59:04 +01:00
|
|
|
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
|
2023-01-06 17:08:07 +01:00
|
|
|
function log {
|
|
|
|
echo `date "+%Y-%m-%d %H:%M:%S.%N"` "${1}" >> "${logfp}"
|
|
|
|
}
|
2022-12-25 11:32:49 +01:00
|
|
|
while true; do
|
2023-01-06 17:08:07 +01:00
|
|
|
dom=$((`date "+%d"`+0))
|
2023-12-29 10:01:16 +01:00
|
|
|
[ $dom -lt $resdom -a -f "$resurrfp" ] && rm "$resurrfp"
|
2024-02-25 08:59:04 +01:00
|
|
|
if [[ ($dom -ge $resdom ) && !(-f "$resurrfp") ]]; then # use a gracetime of 2 months
|
2023-12-29 10:01:16 +01:00
|
|
|
touch "$resurrfp"
|
2024-02-25 08:59:04 +01:00
|
|
|
log "### Starting peerscrawl.php with a 2 months gracetime ###"
|
2024-01-02 00:48:06 +01:00
|
|
|
./peerscrawl.php -g 2M -e peerscrawl.exclude &> $cmdlogfp
|
2024-02-25 08:59:04 +01:00
|
|
|
else # use the default gracetime
|
|
|
|
log "### Starting peerscrawl.php with the default gracetime ###"
|
2023-01-06 17:08:07 +01:00
|
|
|
./peerscrawl.php -e peerscrawl.exclude &> $cmdlogfp
|
|
|
|
fi
|
|
|
|
tail $cmdlogfp >> $logfp
|
2024-02-25 08:59:04 +01:00
|
|
|
log "### THE END ###"
|
2022-12-25 11:32:49 +01:00
|
|
|
done
|
|
|
|
exit 0;
|