update.sh 491 B

12345678910111213141516171819202122
  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 'Invalid content from URL:'
  17. # Cleanup
  18. rm -f "${PID_FILE}"