Browse Source

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 năm trước cách đây
mục cha
commit
669708a24d
1 tập tin đã thay đổi với 12 bổ sung và 0 xóa
  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"