MastodonHelp/web/clitools/crawl.bash
pezcurrel 1098d105fa ...
2020-10-26 16:05:59 +01:00

38 lines
853 B
Bash
Executable file

#!/bin/bash
LOGF="crawl.log"
BASEDIR=$(dirname "$0")
cd "$BASEDIR"
# $1: comando; $2: logfile per l'output del comando
function logcmd {
echo "$(date): eseguo «$1»" >> $LOGF
$1 > $2
ec=$?
echo -n "$(date): fine esecuzione di «$1»: " >> $LOGF
if [ $ec -eq 0 ]; then
echo "riuscita!" >> $LOGF
else
echo "ERRORE: $ec" >> $LOGF
tail $2 >> $LOGF
fi
echo "@@@@@@" >> $LOGF
}
#logcmd "grep pippo gigi" "grepa.log"
#logcmd "grep pippo bibi" "grepb.log"
#exit
logcmd "php mustool.php setold updstats" "mustool.setold-updstats.log"
if [ "$1" == "dopeers" ]; then
logcmd "php peerscrawl.php -e peerscrawl.exclude" "peerscrawl.log"
logcmd "php crawler.php -p peers" "crawler.log"
else
logcmd "php crawler.php" "crawler.log"
fi
# setblack tanto per scrupolo
logcmd "php mustool.php setblack shuffle" "mustool.setblack-shuffle.log"
exit 0