update.sh 579 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. # Parameters
  3. MEDIA_PATH="`~/bin/video/mediaPath`"
  4. # Check and write the run file
  5. PID_FILE="/tmp/ytUpdate.pid"
  6. if [ -f "${PID_FILE}" ]; then
  7. PID=`cat "${PID_FILE}"`
  8. if ps auwx | grep -v grep | grep "`basename "${0}"`" | grep -q "${PID}"; then
  9. exit 0
  10. fi
  11. fi
  12. echo $$ > "${PID_FILE}"
  13. # Execute
  14. find "${MEDIA_PATH}/YouTube" -maxdepth 1 -mindepth 1 -type d \
  15. -exec ~/bin/video/yt/subscribe.pl {} \; 2>&1 | \
  16. grep -v 'giving up after 10 retries' | \
  17. grep -v 'Did not get any data blocks' | \
  18. grep -v 'The read operation timed out'
  19. # Cleanup
  20. rm -f "${PID_FILE}"