From 82f51a45ba7b0e41086d8de3c8f1eb0e939c5520 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 19 Sep 2021 00:23:37 +0200 Subject: [PATCH] restart ipfs daemon (if ~/.ipfs/config.new have changed) or "ipfs id" timeout 10s --- cron_MINUTE.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cron_MINUTE.sh b/cron_MINUTE.sh index 2681856..dac854c 100755 --- a/cron_MINUTE.sh +++ b/cron_MINUTE.sh @@ -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