better pinning

This commit is contained in:
qo-op 2021-02-22 02:30:10 +01:00
parent bd3e5ef140
commit 93f723a112
1 changed files with 7 additions and 5 deletions

View File

@ -103,20 +103,22 @@ IamBOOTSTRAP=$(cat ~/.zen/astrXbian/A_boostrap_nodes.txt | grep "$G1PUB") # AM I
if [[ "$IamBOOTSTRAP" == "$G1PUB" ]]; then
## AUTO PIN FRIENDS ACTIVATION
# /home/fred/.zen/ipfs_swarm/.12D3KooWB2PWQegymKFGdhKGQbyvnp5RQvjFPzz6KC6sxeo3juaB/PIN/QmbkFKpmfaZyFTBNGbnsLDuaQULzLTAS5DBYHjSYVDrFen/2D2LfX7GaQynDooqn1Eb21zavbgcNJucMbjrafe9qxrF
for astrofile in $(ls ~/.zen/ipfs_swarm/.*/PIN/*/* | grep -Ev ${IPFSNODEID} | cut -d '/' -f 8 | sort | uniq );
for ipfsid in $(ls ~/.zen/ipfs_swarm/.*/PIN/*/* | grep -Ev ${IPFSNODEID} | cut -d '/' -f 8 | sort | uniq); do ~/.zen/astrXbian/zen/tools/timeout.sh -t 5 ipfs ls $ipfsid 2>/dev/null | cut -d ' ' -f 1; done
for ipfsfile in $(ls ~/.zen/ipfs_swarm/.*/PIN/*/* | grep -Ev ${IPFSNODEID} | cut -d '/' -f 8 | sort | uniq );
do
# /home/fred/.zen/ipfs_swarm/.12D3KooWB2PWQegymKFGdhKGQbyvnp5RQvjFPzz6KC6sxeo3juaB/PIN/QmbkFKpmfaZyFTBNGbnsLDuaQULzLTAS5DBYHjSYVDrFen/2D2LfX7GaQynDooqn1Eb21zavbgcNJucMbjrafe9qxrF
# PINNING NEW FILE
astrofile=$(~/.zen/astrXbian/zen/tools/timeout.sh -t 5 ipfs ls $ipfsfile 2>/dev/null | cut -d ' ' -f 1)
echo "PINNING ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile} ??"
if [[ ! -d ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile} ]];
if [[ ! -d ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile} && "${astrofile}" != "" ]];
then
echo "PIN : $astrofile"
ipfs ls ${astrofile}
ipfs pin add /ipfs/$astrofile && mkdir -p ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile}/
echo "PUBLISHING MY PIN"
[[ -d ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile} ]] && echo "0" > ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile}/$G1PUB
[[ -d ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile} ]] && echo "0" > ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile}/$G1PUB && break
fi
# EXIT AFTER ONE PIN ONLY (next PIN in cron_MINUTE time)
[[ -f ~/.zen/ipfs/.${IPFSNODEID}/PIN/${astrofile}/$G1PUB ]] && break
done
fi
################## AUTO PINNING