master
text 33 lines 681 Bytes
Raw
1 #!/bin/bash
2
3 if [ "$#" -ne 1 ]; then
4 echo "usage: $0 <ipfs-or-ipns-path>"
5 echo "republishes an ipns name every 20 minutes"
6 echo "(this is an icky stop-gap until ipfs nodes do it for you)"
7 echo ""
8 echo "example:"
9 echo " > $0 QmSYCpuKPbPQ2iFr2swJj2hvz7wQUXfPBXPiuVsQdL5FEs"
10 echo ""
11 exit 1
12 fi
13
14 # must be run online.
15 ipfs swarm peers >/dev/null
16 if [ $? -ne 0 ]; then
17 echo "error: ipfs daemon must be online and connected to peers "
18 exit 1
19 fi
20
21 # check the object is there
22 ipfs dag stat "$1" >/dev/null
23 if [ $? -ne 0 ]; then
24 echo "error: ipfs cannot find $1"
25 exit 1
26 fi
27
28 echo "republishing $1 every 20 minutes"
29 while :
30 do
31 ipfs name publish $1
32 sleep 1200
33 done