Просмотр исходного кода

Split for different execution environments

Zachary Kotlarek 12 лет назад
Родитель
Сommit
a354f4958d
2 измененных файлов с 20 добавлено и 16 удалено
  1. 1 16
      backup/syncAll.sh
  2. 19 0
      backup/syncPhotos.sh

+ 1 - 16
backup/syncAll.sh

@@ -20,7 +20,7 @@ if [ ! -d "${TMPDIR}" ]; then
 fi
 
 # Bail if we're already running
-PID_FILE="${TMPDIR}/syncAll.pid"
+PID_FILE="${TMPDIR}/`basename "${0}"`.pid"
 touch "${PID_FILE}"
 read SYNC_PID < "${PID_FILE}"
 if [ -n "${SYNC_PID}" ] && ps -A -o pid | grep -q "${SYNC_PID}"; then
@@ -40,21 +40,6 @@ fi
 "${SYNC_BIN}" TV 5
 "${SYNC_BIN}" YouTube 50
 
-# If iPhoto is available back it up too
-if compgen -c hdiutil > /dev/null 2>&1; then
-	MOUNTED=0
-	if [ ! -d /Volumes/iPhoto ]; then
-		MOUNTED=1
-		hdiutil attach -readonly /mnt/media/Pictures/iPhoto.sparsebundle >/dev/null 2>&1
-	fi
-	if [ -d /Volumes/iPhoto ]; then
-		BASE_LOCAL="/Volumes/iPhoto" "${SYNC_BIN}" Shared.photolibrary 1000
-		if [ $MOUNTED -gt 0 ]; then
-			hdiutil detach /Volumes/iPhoto >/dev/null 2>&1
-		fi
-	fi
-fi
-
 # Always exit cleanly
 rm -f "${PID_FILE}"
 exit 0

+ 19 - 0
backup/syncPhotos.sh

@@ -0,0 +1,19 @@
+#!/bin/bash
+
+BASE_LOCAL="/Volumes/iPhoto"
+BASE_REMOTE="/Volumes/webdav.opendrive.com"
+
+MOUNTED_PHOTOS=0
+if [ ! -d /Volumes/iPhoto ]; then
+	MOUNTED_PHOTOS=1
+	hdiutil attach -readonly /mnt/media/Pictures/iPhoto.sparsebundle >/dev/null 2>&1
+fi
+if [ -d /Volumes/iPhoto ]; then
+	~/bin/video/backup/sync.sh Shared.photolibrary 1000
+	if [ $MOUNTED_PHOTOS -gt 0 ]; then
+		hdiutil detach /Volumes/iPhoto >/dev/null 2>&1
+	fi
+fi
+
+# Always exit cleanly
+exit 0