astrXbian/www/boris/get_ipfs_node_id.sh

6 lines
245 B
Bash
Raw Permalink Normal View History

#!/bin/bash
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
IPFSNODEID=$(ipfs --timeout=20s id -f='<id>\n')
echo -n $IPFSNODEID