summaryrefslogtreecommitdiff
path: root/toso-mbsync.sh
blob: 91ad498adef64d15907d8f42cc53194549723fc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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