From 003930ef46cb780e08c931a9820ebce7c30fc44a Mon Sep 17 00:00:00 2001 From: qo-op Date: Thu, 11 Mar 2021 22:56:12 +0100 Subject: [PATCH] protect against empty $IPFSNODEID --- zen/ipfs_SWARM_refresh.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zen/ipfs_SWARM_refresh.sh b/zen/ipfs_SWARM_refresh.sh index 199fe86..a01c7db 100755 --- a/zen/ipfs_SWARM_refresh.sh +++ b/zen/ipfs_SWARM_refresh.sh @@ -20,7 +20,7 @@ ME="${0##*/}" ######################################################################## # 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 IPFSNODEID=$(ipfs id -f='\n') +export IPFSNODEID=$(ipfs id -f='\n') && [[ ! $IPFSNODEID ]] && exit 1 ######################################################################## mkdir -p ~/.zen/ipfs_swarm echo ' @@ -33,8 +33,8 @@ echo "I am $IPFSNODEID" timestamp=$(date -u +%s%N | cut -b1-13) ######################################################################## -# Delete "ipfs_swarm" if file structure is evolving... or online only mode -[[ ! -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 +# Delete "ipfs" & "ipfs_swarm" after reboot +[[ ! -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 touch /tmp/treated.ipfs.swarm