浏览代码

mailsync.sh for posix sh

tags/v3.1
Luke Smith 6 年前
父节点
当前提交
cdc1c9d66c
找不到此签名对应的密钥 GPG 密钥 ID: 4C50B54A911F6252
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. +4
    -4
      etc/mailsync.sh

+ 4
- 4
etc/mailsync.sh 查看文件

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
# This script will run offlineimap and check
# for new email if there is an internet connection.
#
@@ -11,7 +11,7 @@ export DISPLAY=:0.0

# Checks for internet connection and set notification script.
# Settings are different for MacOS (Darwin) systems.
if [ "$(uname)" == "Darwin" ]
if [ "$(uname)" = "Darwin" ]
then
ping -q -t 1 -c 1 `ip r | grep -m 1 default | cut -d ' ' -f 3` >/dev/null || exit
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;}
@@ -32,10 +32,10 @@ pkill -RTMIN+12 i3blocks
for account in $(ls ~/.mail)
do
#List unread messages newer than last mailsync and count them
newcount=$(find ~/.mail/$account/INBOX/new/ -type f -newer ~/.config/mutt/etc/mailsynclastrun 2> /dev/null | wc -l)
newcount=$(find ~/.mail/"$account"/INBOX/new/ -type f -newer ~/.config/mutt/etc/mailsynclastrun 2> /dev/null | wc -l)
if [ "$newcount" -gt "0" ]
then
notify "$account" "$newcount" & disown
setsid notify "$account" "$newcount" &
fi
done
notmuch new


正在加载...
取消
保存