diff options
author | Jason Reiss <jreiss@multitech.com> | 2017-12-07 13:00:04 -0600 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2017-12-07 14:45:09 -0600 |
commit | cfa3304d0342837398ebce753d5aa51a8b591ac1 (patch) | |
tree | 4db8598fe8a79237adb4baed6db183a948776bab /recipes-connectivity/lora/lora-network-server | |
parent | 0dc65548a2b3c9a29f68bb8e74b8e6e2c13fb04b (diff) | |
download | meta-mlinux-cfa3304d0342837398ebce753d5aa51a8b591ac1.tar.gz meta-mlinux-cfa3304d0342837398ebce753d5aa51a8b591ac1.tar.bz2 meta-mlinux-cfa3304d0342837398ebce753d5aa51a8b591ac1.zip |
lora: update network server to 2.0.8 and add lock to init script
Diffstat (limited to 'recipes-connectivity/lora/lora-network-server')
-rwxr-xr-x | recipes-connectivity/lora/lora-network-server/lora-network-server.init | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/recipes-connectivity/lora/lora-network-server/lora-network-server.init b/recipes-connectivity/lora/lora-network-server/lora-network-server.init index 9dc8f7a..032a0f7 100755 --- a/recipes-connectivity/lora/lora-network-server/lora-network-server.init +++ b/recipes-connectivity/lora/lora-network-server/lora-network-server.init @@ -2,6 +2,7 @@ NAME="lora-network-server" +LOCK="/var/lock/$NAME" ENABLED="yes" @@ -147,17 +148,35 @@ if [ "$ENABLED" != "yes" ]; then exit fi +force_stop() { + do_stop + rm -fr $LOCK +} + +function try_lock() { + if mkdir $LOCK; then + trap "rm -fr $LOCK" EXIT + else + echo "Lora Network Server lock not acquired, resource in use" + exit 1 + fi +} + + + case "$1" in "start") + try_lock do_start ;; "stop") - do_stop + force_stop ;; "restart") ## Stop the service and regardless of whether it was ## running or not, start it again. + try_lock do_stop do_start ;; |