update.sh 542 B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. # Parameters
  3. MEDIA_PATH="`~/bin/video/mediaPath`"
  4. # Check and write the run file
  5. PID_FILE="${TMPDIR}/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. if [ $DEBUG -gt 0 ]; then
  10. echo "Already running: ${PID}" 1>&2
  11. exit -1
  12. else
  13. exit 0
  14. fi
  15. fi
  16. fi
  17. echo $$ > "${PID_FILE}"
  18. # Execute
  19. find "${MEDIA_PATH}/YouTube" -maxdepth 1 -mindepth 1 -type d \
  20. -exec ~/bin/video/yt/ytSubscribe.pl {} \;
  21. # Cleanup
  22. rm -f "${PID_FILE}"