瀏覽代碼

Ensure TMPDIR is set before we use it. It *should* be, but sometimes under cron it is not, so double-check and add a default if the detection fails

Zachary Kotlarek 13 年之前
父節點
當前提交
669708a24d
共有 1 個文件被更改,包括 12 次插入 和 0 次删除
  1. 12 0
      mountMedia

+ 12 - 0
mountMedia

@@ -1,5 +1,17 @@
 #!/bin/bash
 
+# Ensure we have a valid TMPDIR
+if [ ! -d "${TMPDIR}" ]; then
+        TMPDIR="`getconf DARWIN_USER_TEMP_DIR 2>/dev/null`"
+        if [ ! -d "${TMPDIR}" ]; then
+                TMPDIR="/var/tmp"
+        fi
+        if [ ! -d "${TMPDIR}" ]; then
+                TMPDIR="/tmp"
+        fi
+fi
+
+# Config
 HOST="vera.uberzach.com"
 LOCK="${TMPDIR}/mountMedia.mounting"