if multiple sxmo_rtcwake processes are running, return to crust only when the last one exits

Signed-off-by: Stacy Harper <contact@stacyharper.net>
master
Maarten van Gompel 3 years ago committed by Stacy Harper
parent 4798717d9d
commit 2b5f2b97e7
No known key found for this signature in database
GPG Key ID: 5BAC92328B7C5D65
  1. 6
      scripts/core/sxmo_rtcwake.sh

@ -14,8 +14,14 @@ finish() {
if grep -q crust "$LASTSTATE" \ if grep -q crust "$LASTSTATE" \
&& grep -q rtc "$UNSUSPENDREASONFILE" \ && grep -q rtc "$UNSUSPENDREASONFILE" \
&& [ "$(sxmo_screenlock.sh getCurState)" != "unlock" ]; then && [ "$(sxmo_screenlock.sh getCurState)" != "unlock" ]; then
WAKEPROCS=$(pgrep -f sxmo_rtcwake.sh | wc -l)
if [ "$WAKEPROCS" -gt 2 ]; then
#each process also spawns a blink subprocess, so we check if there are more than two rather than one:
echo "sxmo_rtcwake: returning without crust, other sxmo_rtcwake process is still running ($(date))" >&2
else
echo "sxmo_rtcwake: going back to crust ($(date))" >&2 echo "sxmo_rtcwake: going back to crust ($(date))" >&2
sxmo_screenlock.sh crust sxmo_screenlock.sh crust
fi
else else
echo "sxmo_rtcwake: returning without crust ($(date))" >&2 echo "sxmo_rtcwake: returning without crust ($(date))" >&2
fi fi

Loading…
Cancel
Save