summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2018-03-13 08:18:43 -0700
committerGitHub <noreply@github.com>2018-03-13 08:18:43 -0700
commit56cb13e822eefafa9e140e11776d8d994cba42c6 (patch)
treebd7ec7749ee4b92459afb826e651618edd013dd1 /etc
parenta4e016a8f33c76c963df256d47d8b78cb1a80d74 (diff)
parent4537d35666b9c23f82e9c5f2c0e838c09959906a (diff)
Merge pull request #35 from meain/macos
MacOS compatibility
Diffstat (limited to 'etc')
-rwxr-xr-xetc/mailsync.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/etc/mailsync.sh b/etc/mailsync.sh
index 61eeade..4810ce7 100755
--- a/etc/mailsync.sh
+++ b/etc/mailsync.sh
@@ -7,8 +7,13 @@
#
# I have this run as a cronjob every 5 minutes.
-# Check for internet connection. Exit script if none.
-ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` >/dev/null || exit
+# Check for internet connection. Exit script if none. (timeout in mac is `-t`)
+if [ "$(uname)" == "Darwin" ]
+then
+ ping -q -t 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` >/dev/null || exit
+else
+ ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` >/dev/null || exit
+fi
# Get current number of new mail, then begin sync.
ori=$(find ~/.mail -wholename '*/new/*' | grep -vi "spam\|trash\|junk" | wc -l)