protect against empty $IPFSNODEID
This commit is contained in:
parent
792e4d1885
commit
003930ef46
|
@ -20,7 +20,7 @@ ME="${0##*/}"
|
||||||
########################################################################
|
########################################################################
|
||||||
# TODO remove because now it is in~/.bashrc
|
# TODO remove because now it is in~/.bashrc
|
||||||
export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
|
export YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
|
||||||
export IPFSNODEID=$(ipfs id -f='<id>\n')
|
export IPFSNODEID=$(ipfs id -f='<id>\n') && [[ ! $IPFSNODEID ]] && exit 1
|
||||||
########################################################################
|
########################################################################
|
||||||
mkdir -p ~/.zen/ipfs_swarm
|
mkdir -p ~/.zen/ipfs_swarm
|
||||||
echo '
|
echo '
|
||||||
|
@ -33,8 +33,8 @@ echo "I am $IPFSNODEID"
|
||||||
timestamp=$(date -u +%s%N | cut -b1-13)
|
timestamp=$(date -u +%s%N | cut -b1-13)
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Delete "ipfs_swarm" if file structure is evolving... or online only mode
|
# Delete "ipfs" & "ipfs_swarm" after reboot
|
||||||
[[ ! -f /tmp/swarm_cleaned ]] && rm -Rf /home/$YOU/.zen/ipfs_swarm/ && mkdir -p /home/$YOU/.zen/ipfs_swarm && echo "SWARM CLEAN OK" > /tmp/swarm_cleaned
|
[[ ! -f /tmp/swarm_cleaned ]] && rm -Rf ~/.zen/ipfs/* && rm -Rf ~/.zen/ipfs_swarm/ && mkdir -p ~/.zen/ipfs_swarm && echo "IPFS CLEANING OK" > /tmp/swarm_cleaned
|
||||||
########################################################################
|
########################################################################
|
||||||
rm /tmp/treated.ipfs.swarm
|
rm /tmp/treated.ipfs.swarm
|
||||||
touch /tmp/treated.ipfs.swarm
|
touch /tmp/treated.ipfs.swarm
|
||||||
|
|
Loading…
Reference in New Issue