prevent running more than once

This commit is contained in:
fred 2021-08-05 23:47:37 +02:00
parent 9394661d51
commit 25b414c69c
2 changed files with 3 additions and 1 deletions

View File

@ -7,7 +7,6 @@
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0

View File

@ -3,6 +3,9 @@
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
countMErunning=$(ps auxf --sort=+utime | grep -w $ME | grep -v -E 'color=auto|grep' | wc -l)
[[ $countMErunning -gt 2 ]] && echo "$ME already running $countMErunning time" && exit 0
########################################################################
IPFSNODEID=$(ipfs --timeout=30s id -f='<id>\n')
[[ $IPFSNODEID == "" ]] && echo "ipfs TIMEOUT" && exit 1