astrXbian/zen/tools/add_externIP_to_ipfstryme.sh

23 lines
978 B
Bash
Raw Normal View History

2020-12-24 16:29:36 +01:00
#!/bin/bash
########################################################################
# Author: Armust (support@qo-op.com)
# Version: 2020.12.24
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1);
IPFSNODEID=$(ipfs id -f='<id>\n')
EXTERNIP=$(curl -s http://whatismyip.akamai.com/)
########################################################################
echo "ADD $EXTERNIP to /home/$YOU/.zen/ipfs/.${IPFSNODEID}/tryme.addr"
########################################################################
mkdir -p ~/.zen/ipfs/.${IPFSNODEID}
2020-12-24 16:43:37 +01:00
echo "/ip4/$EXTERNIP/udp/4001/astro/p2p/${IPFSNODEID}" >> /home/$YOU/.zen/ipfs/.${IPFSNODEID}/tryme.addr
2020-12-24 16:29:36 +01:00
exit 0