summaryrefslogtreecommitdiff
path: root/etc/mailsync.sh
diff options
context:
space:
mode:
Diffstat (limited to 'etc/mailsync.sh')
-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)