restart ipfs daemon (if ~/.ipfs/config.new have changed) or "ipfs id" timeout 10s

This commit is contained in:
fred 2021-09-19 00:23:37 +02:00
parent 19892fa79c
commit 82f51a45ba
1 changed files with 10 additions and 8 deletions

View File

@ -192,10 +192,17 @@ fi
# TODO: IDEA make gchange/ipfs/ipns refresh speed depending on ipfs swarm size and DEFCON level !
## SYNC GCHANGE EVERY 12 hours runtime
[[ $(($runtime % 725)) == 0 || "$runtime" == "5" ]] && $MY_PATH/zen/gchange_INIT.sh 2>&1 > /home/${YOU}/.zen/ipfs/.${IPFSNODEID}/.log.gchange_INIT.txt
## SYNC SWARM EVERY 6h runtime
# If NEW ~/.ipfs/config.new => restarting IPFS daemon
if [[ -f ~/.ipfs/config.new && $(diff ~/.ipfs/config.new ~/.ipfs/config) ]]; then
cp ~/.ipfs/config.new ~/.ipfs/config
[[ -f /etc/sudoers.d/systemctl ]] && sudo systemctl restart ipfs && exit 0
[[ ${YOU} == "xbian" ]] && sudo service ipfs restart && exit 0
fi
## RESHAPE IPFS FRIENDS SWARM
[[ $(($runtime % 370)) == 0 || "$runtime" == "10" ]] && $MY_PATH/zen/gchange_IPFS_swarm.sh 2>&1 > /home/${YOU}/.zen/ipfs/.${IPFSNODEID}/.log.gchange_IPFS_swarm.txt
# QUICK SYNC SWARM EVERY 30 minutes
## CLEAN OLD SESSION
# SYNC IPFS FRIENDS SWARM
if [[ $(($runtime % 30)) == 0 ]]; then
kill -9 $(ps auxf --sort=+utime | grep -w p4n.swarmscraper.sh | grep -v -E 'color=auto|grep' | tail -n 1 | awk '{print $2}')
killall chromium
@ -244,11 +251,6 @@ if [[ "$timebar" == "12:12" || "$timebar" == "00:12" || "$timebar" == "03:03" ||
rm -f ~/.zen/A_dead_swarm.txt
fi
# At 03:03 and every 6h runtime restarting IPFS daemon
[[ "$timebar" == "03:03" || $(($runtime % 363)) == 0 ]] && [[ -f ~/.ipfs/config.new ]] && cp ~/.ipfs/config.new ~/.ipfs/config
[[ "$timebar" == "03:03" || $(($runtime % 363)) == 0 ]] && [[ -f /etc/sudoers.d/systemctl ]] && sudo systemctl restart ipfs && exit 0
[[ "$timebar" == "03:03" || $(($runtime % 363)) == 0 ]] && [[ ${YOU} == "xbian" ]] && sudo service ipfs restart && exit 0
##################################################################
##################################################################
# 5 mn / 24h REBOOT & MIDNIGHT:01 : CLEANING & UPDATE