PMSHelper.sh 728 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. # Run interactively if requested
  3. INTERACTIVE=0
  4. if basename "${0}" | grep -iq interactive; then
  5. INTERACTIVE=1
  6. fi
  7. # This looks like it always loops
  8. # But if we exec at the end bash just goes away and the loop doesn't matter
  9. while [ 1 ]; do
  10. # Always re-trigger a mount (to fix links if the network changes)
  11. ~/bin/video/mountMedia
  12. # Wait for the media share to be mounted
  13. if ! ~/bin/video/isMediaMounted; then
  14. sleep 5
  15. if [ $INTERACTIVE -gt 0 ]; then
  16. continue
  17. else
  18. exit 1
  19. fi
  20. fi
  21. # Kill previous instances
  22. ~/bin/video/pms/killPMS.sh
  23. # Exec
  24. EXEC=""
  25. if [ $INTERACTIVE -le 0 ]; then
  26. EXEC="exec"
  27. fi
  28. $EXEC '/Applications/Zach/Media/Plex Media Server.app/Contents/MacOS/Plex Media Server'
  29. done