-
Notifications
You must be signed in to change notification settings - Fork 0
/
pullmail.sh
executable file
·34 lines (31 loc) · 1.26 KB
/
pullmail.sh
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
#!/bin/bash
# file: pullmail.sh
#
# This script may be called via a cron job to allow
# offlineimap (and imapfilter) to use the environmental
# variables to access from gnome-keyring
#
# Attaches the current BASH session to a GNOME keyring daemon
#
# Returns 0 on success 1 on failure.
#
# Example cron call: (change the times to suit)
#
# * * * * * /home/pazz/bin/pullmail.sh > /home/pazz/.pullmail.log
# * * * * * sleep 30;/home/pazz/bin/pullmail.sh > /home/pazz/.pullmail.log
#
function gnome-keyring-control() {
local -a vars=( \
DBUS_SESSION_BUS_ADDRESS \
GNOME_KEYRING_CONTROL \
GNOME_KEYRING_PID \
XDG_SESSION_COOKIE \
GPG_AGENT_INFO \
SSH_AUTH_SOCK \
)
local pid=$(ps -C awesome -o pid --no-heading)
eval "unset ${vars[@]}; $(printf "export %s;" $(sed 's/\x00/\n/g' /proc/${pid//[^0-9]/}/environ | grep $(printf -- "-e ^%s= " "${vars[@]}")) )"
}
gnome-keyring-control
#/usr/local/bin/offlineimap -c /home/pazz/.offlineimaprc -o -u Noninteractive.Basic && /usr/local/bin/notmuch new && /home/pazz/bin/sort_mail.py
/home/pazz/.local/bin/offlineimap -c /home/pazz/.offlineimaprc -o && /usr/local/bin/notmuch new && /home/pazz/.local/bin/afew --tag --new