@cryptotaxi247 / kubo / commits / 73e3e90cd

simple ipns-republish script stopgap

Juan Batiz-Benet committed May 10, 2015 at 09:23 UTC 73e3e90cd9c5bc08783570c406523f471f6c709e
1 file changed +33
bin/ipns-republish new
+33
@@ -0,0 +1,33 @@
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 object 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