From dba2255cd1dbdb730b2382ce895b1dafc7ce6a14 Mon Sep 17 00:00:00 2001 From: qo-op Date: Mon, 12 Jul 2021 15:14:07 +0200 Subject: [PATCH] cannot run multiple time simultaneously --- sms_send_tosend.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sms_send_tosend.sh b/sms_send_tosend.sh index be267cd..56d3d8e 100755 --- a/sms_send_tosend.sh +++ b/sms_send_tosend.sh @@ -11,6 +11,10 @@ YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail [[ ! -f /home/${YOU}/.zen/secret.dunikey ]] && echo "Crypto is missing... please install 'astrXbian' TestNet" && exit 1 G1PUB=$(cat /home/${YOU}/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) +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. EXIT." && exit 0 + ## STOP GAMMU-SMSD sudo service gammu-smsd stop