You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

facelock.sh 462B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. locker() {
  3. while ! mlock; do
  4. echo "mlock died!!! $?"
  5. sleep 0.5
  6. done
  7. }
  8. matcher() {
  9. while ! ./facematcher.py match -d 2 faces/martin/*; do
  10. echo "facematcher died!!! $?"
  11. sleep 2
  12. done
  13. }
  14. trap 'kill $(jobs -p)' EXIT
  15. locker &
  16. lockerpid=$!
  17. matcher &
  18. matcherpid=$!
  19. while :; do
  20. if ! kill -0 $lockerpid; then
  21. kill $matcherpid
  22. wait
  23. exit 0
  24. elif ! kill -0 $matcherpid; then
  25. kill $lockerpid
  26. pkill i3lock
  27. wait
  28. exit 0
  29. fi
  30. sleep 1
  31. done