~/.ipfs/config.new Peering.Peers & ipfs daemon restart
This commit is contained in:
parent
57f1ba826a
commit
d74b7528b5
|
@ -27,8 +27,8 @@ IPFSNODEID=$(ipfs --timeout=10s id -f='<id>\n')
|
||||||
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
|
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
|
||||||
if [[ ! ${YOU} ]]; then
|
if [[ ! ${YOU} ]]; then
|
||||||
# reduice water levels for swarm
|
# reduice water levels for swarm
|
||||||
ipfs config --json Swarm.ConnMgr.LowWater 200
|
ipfs config --json Swarm.ConnMgr.LowWater 50
|
||||||
ipfs config --json Swarm.ConnMgr.HighWater 400
|
ipfs config --json Swarm.ConnMgr.HighWater 100
|
||||||
[[ "${USER}" == "xbian" ]] && sudo service ipfs restart || sudo systemctl restart ipfs
|
[[ "${USER}" == "xbian" ]] && sudo service ipfs restart || sudo systemctl restart ipfs
|
||||||
echo "ERROR! ipfs daemon was not running. RELAUNCHING."
|
echo "ERROR! ipfs daemon was not running. RELAUNCHING."
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -36,7 +36,7 @@ fi
|
||||||
########################################################################
|
########################################################################
|
||||||
# CORRECT VSTREAM ASTROPORT SITE/ART REMOVED AFTER PLUGIN UPDATE
|
# CORRECT VSTREAM ASTROPORT SITE/ART REMOVED AFTER PLUGIN UPDATE
|
||||||
[[ ! -f ~/.kodi/addons/plugin.video.vstream/resources/sites/astroport.py ]] && [[ -f ~/.zen/astroport.py ]] && cp -f ~/.zen/astroport.py ~/.kodi/addons/plugin.video.vstream/resources/sites/
|
[[ ! -f ~/.kodi/addons/plugin.video.vstream/resources/sites/astroport.py ]] && [[ -f ~/.zen/astroport.py ]] && cp -f ~/.zen/astroport.py ~/.kodi/addons/plugin.video.vstream/resources/sites/
|
||||||
[[ ! -f ~/.kodi/addons/plugin.video.vstream/resources/art/astroport.png ]] && cp ~/.zen/astrXbian/.install/.kodi/addons/plugin.video.vstream/resources/art/astroport.png ~/.kodi/addons/plugin.video.vstream/resources/art/
|
[[ ! -f ~/.kodi/addons/plugin.video.vstream/resources/art/astroport.png ]] && cp ~/.zen/astrXbian/.install/.kodi/addons/plugin.video.vstream/resources/art/astroport.png ~/.kodi/addons/plugin.video.vstream/resources/art/ 2>/dev/null
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
### NO IP GATEWAY : EXIT
|
### NO IP GATEWAY : EXIT
|
||||||
|
@ -228,9 +228,6 @@ fi
|
||||||
#
|
#
|
||||||
# REFRESHing MEDIAKEY / ZenTAG nano DHTs => Zen File ECONOMY wallet cycle
|
# REFRESHing MEDIAKEY / ZenTAG nano DHTs => Zen File ECONOMY wallet cycle
|
||||||
if [[ "$timebar" == "12:12" || "$timebar" == "00:12" || "$timebar" == "03:03" || $(($runtime % 720)) == 0 || $runtime == 12 ]]; then
|
if [[ "$timebar" == "12:12" || "$timebar" == "00:12" || "$timebar" == "03:03" || $(($runtime % 720)) == 0 || $runtime == 12 ]]; then
|
||||||
# At 03:03 and every 12h runtime restarting IPFS daemon
|
|
||||||
[[ "$timebar" == "03:03" || $(($runtime % 360)) == 0 ]] && [[ -f /etc/sudoers.d/systemctl ]] && sudo systemctl restart ipfs && exit 0
|
|
||||||
[[ "$timebar" == "03:03" || $(($runtime % 720)) == 0 ]] && [[ ${YOU} == "xbian" ]] && sudo service ipfs restart && exit 0
|
|
||||||
|
|
||||||
#### Refresh & publish MEDIAKEYs
|
#### Refresh & publish MEDIAKEYs
|
||||||
$MY_PATH/zen/ipns_TAG_refresh.sh
|
$MY_PATH/zen/ipns_TAG_refresh.sh
|
||||||
|
@ -239,6 +236,11 @@ if [[ "$timebar" == "12:12" || "$timebar" == "00:12" || "$timebar" == "03:03" ||
|
||||||
rm -f ~/.zen/A_dead_swarm.txt
|
rm -f ~/.zen/A_dead_swarm.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# At 03:03 and every 6h runtime restarting IPFS daemon
|
||||||
|
[[ "$timebar" == "03:03" || $(($runtime % 360)) == 0 ]] && [[ -f ~/.ipfs/config.new ]] && cp ~/.ipfs/config.new ~/.ipfs/config
|
||||||
|
[[ "$timebar" == "03:03" || $(($runtime % 360)) == 0 ]] && [[ -f /etc/sudoers.d/systemctl ]] && sudo systemctl restart ipfs && exit 0
|
||||||
|
[[ "$timebar" == "03:03" || $(($runtime % 360)) == 0 ]] && [[ ${YOU} == "xbian" ]] && sudo service ipfs restart && exit 0
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
##################################################################
|
##################################################################
|
||||||
# 5 mn / 24h REBOOT & MIDNIGHT:01 : CLEANING & UPDATE
|
# 5 mn / 24h REBOOT & MIDNIGHT:01 : CLEANING & UPDATE
|
||||||
|
|
|
@ -56,8 +56,8 @@ ipfs bootstrap > /tmp/ipfs_swarm_peers
|
||||||
ipfs swarm peers >> /tmp/ipfs_swarm_peers
|
ipfs swarm peers >> /tmp/ipfs_swarm_peers
|
||||||
|
|
||||||
rm ~/.zen/A_peering_peers.txt
|
rm ~/.zen/A_peering_peers.txt
|
||||||
# [[ -f ~/.ipfs/config.bak ]] && cp ~/.ipfs/config.bak ~/.ipfs/config
|
[[ ! -f ~/.ipfs/config.bak ]] && cp ~/.ipfs/config ~/.ipfs/config.bak ## Backup previous original
|
||||||
cp ~/.ipfs/config ~/.ipfs/config.new
|
cp ~/.ipfs/config ~/.ipfs/config.new ## Prepare Peering.Peers changes
|
||||||
|
|
||||||
# for ipfsnodeid in $( (cat /tmp/ipfs_swarm_peers | grep -o '[^/]*$' && cat /tmp/A_swarm | grep -o '[^/]*$' ) | sort | uniq); ## TODO ACTIVATE IN DEFCON 4
|
# for ipfsnodeid in $( (cat /tmp/ipfs_swarm_peers | grep -o '[^/]*$' && cat /tmp/A_swarm | grep -o '[^/]*$' ) | sort | uniq); ## TODO ACTIVATE IN DEFCON 4
|
||||||
for ipfsnodeid in $(cat ~/.zen/ipfs_swarm/.*/tryme.addr | grep -o '[^/]*$' | sort | uniq);
|
for ipfsnodeid in $(cat ~/.zen/ipfs_swarm/.*/tryme.addr | grep -o '[^/]*$' | sort | uniq);
|
||||||
|
@ -114,13 +114,15 @@ do
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
################################################################
|
################################################################
|
||||||
echo "## CREATING Peering.Peer entries"
|
echo "@@ CREATING Peering.Peer @@"
|
||||||
|
echo "jq '.Peering.Peers? += { \"Addrs\": [], \"ID\": \"'$ipfsnodeid'\" }'"
|
||||||
################################################################
|
################################################################
|
||||||
Addr=$(echo "$peerline" | rev | cut -d '/' -f 2- | rev )
|
Addr=$(echo "$peerline" | rev | cut -d '/' -f 2- | rev )
|
||||||
IsAlreadythere=$(cat ~/.ipfs/config.new | grep $ipfsnodeid)
|
IsAlreadythere=$(cat ~/.ipfs/config.new | grep '"$ipfsnodeid"') && echo $IsAlreadythere
|
||||||
if [[ ! $IsAlreadythere ]]; then
|
if [[ ! $IsAlreadythere ]]; then
|
||||||
echo '{ "ID": "'$ipfsnodeid'", "Addrs": [] }' >> ~/.zen/A_peering_peers.txt
|
echo '{ "ID": "'$ipfsnodeid'", "Addrs": [] }' >> ~/.zen/A_peering_peers.txt
|
||||||
jq '.Peering.Peers? += { "Addrs": [], "ID": "'$ipfsnodeid'" }' ~/.ipfs/config.new > ~/.ipfs/config.wew && cp ~/.ipfs/config.wew ~/.ipfs/config.new
|
#jq '.Peering.Peers? += { "Addrs": [], "ID": "'$ipfsnodeid'" }' ~/.ipfs/config.new > ~/.ipfs/config.wew && cp ~/.ipfs/config.wew ~/.ipfs/config.new
|
||||||
|
jq '.Peering.Peers[.Peering.Peers| length] |= . + { "Addrs": [], "ID": "'$ipfsnodeid'" }' ~/.ipfs/config.new > ~/.ipfs/config.wew && cp ~/.ipfs/config.wew ~/.ipfs/config.new
|
||||||
fi
|
fi
|
||||||
################################################################
|
################################################################
|
||||||
## Refresh bootstrap if XID exists
|
## Refresh bootstrap if XID exists
|
||||||
|
|
Loading…
Reference in New Issue