Explorar o código

Wrapper for cron

Zachary Kotlarek %!s(int64=12) %!d(string=hai) anos
pai
achega
f478564704
Modificáronse 1 ficheiros con 26 adicións e 0 borrados
  1. 26 0
      yt/update.sh

+ 26 - 0
yt/update.sh

@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# Parameters
+MEDIA_PATH="`~/bin/video/mediaPath`"
+
+# Check and write the run file
+PID_FILE="${TMPDIR}/ytUpdate.pid"
+if [ -f "${PID_FILE}" ]; then
+	PID=`cat "${PID_FILE}"`
+	if ps auwx | grep -v grep | grep "`basename "${0}"`" | grep -q "${PID}"; then
+		if [ $DEBUG -gt 0 ]; then
+			echo "Already running: ${PID}" 1>&2
+			exit -1
+		else
+			exit 0
+		fi
+	fi
+fi
+echo $$ > "${PID_FILE}"
+
+# Execute
+find "${MEDIA_PATH}/YouTube" -maxdepth 1 -mindepth 1 -type d \
+	-exec ~/bin/video/yt/ytSubscribe.pl {} \;
+
+# Cleanup
+rm -f "${PID_FILE}"