cleaning old files and dir from ipfs_swarm

This commit is contained in:
fred 2021-09-02 22:42:57 +02:00
parent d926f2818a
commit 77b477ec6b
1 changed files with 11 additions and 6 deletions

View File

@ -45,8 +45,10 @@ touch /tmp/treated.ipfs.swarm
########################################################################
########################################################################
echo "******************************************************************"
echo "RETRIEVING MY OWN DATA FROM IPNS TO ~/.zen/ipfs_swarm"
#ipfs get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$IPFSNODEID
echo "REFRESHING MY OWN DATA FROM IPNS TO ~/.zen/ipfs_swarm"
find /home/$YOU/.zen/ipfs_swarm/.$IPFSNODEID/ -type f -mtime +30 -exec rm '{}' \;
find /home/$YOU/.zen/ipfs_swarm/.$IPFSNODEID/ -type d -mtime +30 -exec rmdir '{}' \;
ipfs get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$IPFSNODEID
########################################################################
count=1
ipfs bootstrap > /tmp/ipfs_swarm_peers
@ -104,8 +106,11 @@ do
continue
fi
fi
## Add to bootstrap if XID exists
[[ "$XID" != "" ]] && ipfs bootstrap add "$peerline" || ipfs bootstrap rm "$peerline"
## Refresh bootstrap if XID exists
[[ "$XID" != "" ]] && ipfs bootstrap rm "/ipfs/$ipfsnodeid" && ipfs bootstrap add "$peerline" || ipfs bootstrap rm "$peerline"
echo "Removing 30 days older data from ~/.zen/ipfs_swarm/.$ipfsnodeid/"
find /home/$YOU/.zen/ipfs_swarm/.$ipfsnodeid/ -type f -mtime +30 -exec rm '{}' \;
find /home/$YOU/.zen/ipfs_swarm/.$ipfsnodeid/ -type d -mtime +30 -exec rmdir '{}' \;
echo "OK Friend REFRESH /ipns/$ipfsnodeid INTO ~/.zen/ipfs_swarm/"
ipfs --timeout=60s get --output=/home/$YOU/.zen/ipfs_swarm/ /ipns/$ipfsnodeid
if [ $? != 0 ];
@ -235,7 +240,7 @@ done
# rm ~/.kodi/userdata/addon_data/plugin.video.vstream/astroport_cache.db
########################################################################
# REFRESH tiddlywiki WALL OF FRIENDS
# REFRESH tiddlywiki WALL OF FRIENDS /ipns/${IPFSNODEID}/.${IPFSNODEID}/FRIENDS/index.html
########################################################################
zuid="$(cat ~/.zen/ipfs/.$IPFSNODEID/_xbian.zuid)"
@ -259,7 +264,7 @@ for wiki in $(ls ~/.zen/ipfs_swarm/.12D*/index.html | grep -Ev "${IPFSNODEID}" 2
ipfsnodeid=$(echo $wiki | cut -d '.' -f 3- | cut -d '/' -f 1)
whoisg1=$(~/.zen/astrXbian/zen/tools/ipfs_to_g1.py $ipfsnodeid)
echo "<li>
<a href=\"https://www.gchange.fr/#/app/user?q=$whoisg1\">
<a target=\"gchange\" href=\"https://www.gchange.fr/#/app/user/$whoisg1/\">
<img src=\"https://tube.copylaradio.com/ipns/$ipfsnodeid/.$ipfsnodeid/QR.png\" alt=\"$whoisg1\" />
</a>
<p class='video-title'>