diff options
author | Victor Toso <victortoso@redhat.com> | 2016-02-12 17:10:09 +0100 |
---|---|---|
committer | Victor Toso <victortoso@redhat.com> | 2016-02-12 17:10:09 +0100 |
commit | 7b00475080063056e8c2e868220425d7196167f5 (patch) | |
tree | c44b877f060157a075ff3d00e0845b5750d369ff | |
parent | 8a3aee58934dfdea2948e529ca137579b9cc1935 (diff) |
mbsync: for a cron job to fetch mails
At the moment this is called every minute but mbsync will fetch once
every two minutes some mailbox. Nothing fancy or smart, just wfm.
-rwxr-xr-x | toso-mbsync.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/toso-mbsync.sh b/toso-mbsync.sh new file mode 100755 index 0000000..91ad498 --- /dev/null +++ b/toso-mbsync.sh @@ -0,0 +1,43 @@ +#!/bin/bash +source "$HOME/work/scripts/toso-utils.sh" + +mailboxes="" + +function set_mailboxes() +{ + t_sec=`date "+%s"` + t_min=$(($t_sec / 60)) + t_min=$(($t_min % 10)) + index=$(($t_min / 2)) + odd=$(($t_min % 2)) + redhat="" + + # update once every two minutes + if [ $odd -eq 1 ]; + then + return $bashfalse + fi + + if on_redhat_vpn; + then + redhat="redhat"; + fi + + case $index in + 0) + mailboxes="bugzilla redhat" + ;; + 1) + mailboxes="victortoso" + ;; + 2) + mailboxes="spam redhat" + ;; + 3) + mailboxes="lists" + ;; + esac + return $bashtrue +} + +set_mailboxes && mbsync $mailboxes |