modemmonitortoggle may take an argument "on" or "off" to force toggling to a desired state

Signed-off-by: Anjandev Momi <anjan@momi.ca>
master
Maarten van Gompel 4 years ago committed by Anjandev Momi
parent c915de82d8
commit 17e3b623bf
  1. 9
      scripts/modem/sxmo_modemmonitortoggle.sh

@ -1,7 +1,12 @@
#!/usr/bin/env sh #!/usr/bin/env sh
if pgrep -f sxmo_modemmonitor.sh; then
# This script toggles the modem monitor
# It optionally takes a parameter "on" or "off"
# forcing it to toggle only to that desired state if applicable.
if [ "$1" != "on" ] && pgrep -f sxmo_modemmonitor.sh; then
pgrep -f sxmo_modemmonitor.sh | grep -Ev "^${$}$" | xargs -IP kill -TERM P pgrep -f sxmo_modemmonitor.sh | grep -Ev "^${$}$" | xargs -IP kill -TERM P
else elif [ "$1" != "off" ]; then
setsid -f sxmo_modemmonitor.sh & setsid -f sxmo_modemmonitor.sh &
fi fi

Loading…
Cancel
Save