37 lines
572 B
Bash
37 lines
572 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
node=g1.presles.fr
|
||
|
#g1.cgeek.fr
|
||
|
#node=duniter.moul.re
|
||
|
|
||
|
log="/var/log/duniter-resync.log"
|
||
|
oldlog="/home/poka/scripts/old-resync.log"
|
||
|
|
||
|
echo "Début de la resynchronisation du noeud Duniter"
|
||
|
|
||
|
/usr/bin/duniter stop
|
||
|
sleep 1
|
||
|
|
||
|
tail -n 1 $log >> $oldlog
|
||
|
|
||
|
[[ $1 == "erase" ]] && rm -rf ~/.config/duniter/duniter_default/data/
|
||
|
/usr/bin/duniter sync $node --nointeractive > $log 2>&1 &
|
||
|
BACK_PID=$!
|
||
|
|
||
|
sleep 1
|
||
|
|
||
|
tail $log -f | grep ", Applied" &
|
||
|
LOG_PID=$!
|
||
|
|
||
|
wait $BACK_PID
|
||
|
|
||
|
kill -9 $LOG_PID
|
||
|
|
||
|
sleep 1
|
||
|
|
||
|
/usr/bin/duniter webstart
|
||
|
|
||
|
echo "Duniter a été resyncrhonisé"
|
||
|
|
||
|
exit 0
|