STATION ONLINE or OFFLINE

This commit is contained in:
qo-op 2021-06-29 03:08:47 +02:00
parent 448ef8a395
commit 83195a1d13
1 changed files with 13 additions and 4 deletions

View File

@ -220,14 +220,23 @@ for ipnslink in $(ls ~/.zen/PIN/*/IPNSLINK); do
ipnsid=$(cat $ipnslink)
ipfsid=$(echo $ipnslink | cut -d '/' -f 6)
mediakey=$(cat ~/.zen/PIN/${ipfsid}/MEDIAKEY)
[[ ! $(ipfs key list | grep ${mediakey}) ]] && echo "ERROR MISSING MEDIAKEY" && continue
[[ ! $(ipfs key list | grep ${mediakey}) ]] && echo "ERROR MISSING MEDIAKEY" && continue
## GET ACTUAL IPNS .chain VALUE
actual=$(ipfs --timeout 12s cat /ipns/$ipnsid/.chain)
## PUBLISH IT
[[ $actual ]] && ipfs --timeout 20s name publish -k ${mediakey} --quieter /ipfs/${actual}
echo "REFRESHED https://tube.copylaradio.com/ipns/$ipnsid TO /ipfs/$actual"
if [[ $actual != "" ]]; then
echo "${mediakey} : STATION DHT ONLINE"
ipfs --timeout 20s name publish -k ${mediakey} --quieter /ipfs/${actual}
echo "${actual}" > ~/.zen/PIN/$ipfsid/ACTUAL
else
echo "${mediakey} : STATION OFFLINE"
[[ -f ~/.zen/PIN/$ipfsid/ACTUAL ]] && actual=$(cat ~/.zen/PIN/$ipfsid/ACTUAL) || continue
ipfs --timeout 20s name publish -k ${mediakey} --quieter /ipfs/${actual}
fi
echo "PUBLISH https://tube.copylaradio.com/ipns/$ipnsid TO /ipfs/$actual"
actual=""
done
########################################################################