diff options
Diffstat (limited to 'local/sbin')
-rwxr-xr-x | local/sbin/newmail-notify | 23 | ||||
-rwxr-xr-x | local/sbin/syncemail | 44 |
2 files changed, 0 insertions, 67 deletions
diff --git a/local/sbin/newmail-notify b/local/sbin/newmail-notify deleted file mode 100755 index 7c6b803..0000000 --- a/local/sbin/newmail-notify +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -cd ~/.mail - -if [ -f notify-notified ]; then - NOTIFIED=`cat notify-notified` - rm notify-notified -fi - -for account in `ls`; do - if cd "$account"/INBOX/new; then - for m in `ls`; do - echo $m - echo $m >> ~/.mail/notify-notified - if echo "$NOTIFIED" | grep "$m" >/dev/null; then continue; fi - FROM=`grep -E "^From: " "$m" | sed 's/^From: //' | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)'` - TO=`grep -E "^To: " "$m" | sed 's/^To: //' | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)'` - SUBJECT=`grep -E "^Subject: " "$m" | sed 's/^Subject: //' | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)'` - notify-send "$TO: $FROM" "$SUBJECT" - done - fi - cd ~/.mail -done diff --git a/local/sbin/syncemail b/local/sbin/syncemail deleted file mode 100755 index dfd56a3..0000000 --- a/local/sbin/syncemail +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/python2 -# This starts offlineimap, but first it requests passwords from pass -import os -import sys -import subprocess -import daemon -import lockfile -from offlineimap import OfflineImap - -pidfile = '/tmp/syncemail-%d.pid' % os.getuid() - -# Check if not already running -def check_running(): - if os.access(pidfile, os.F_OK): - with open(pidfile, "r") as f: - pid = f.readline() - if os.path.exists('/proc/%s' % pid): - sys.exit(0) -check_running() - - -accounts = [ - ["email", "mail/cynerd@email.cz"], - ] - -for acc in accounts: - pproc = subprocess.Popen("pass " + acc[1], - stdout=subprocess.PIPE, shell=True) - output = pproc.stdout.read().rstrip() - if pproc.wait() != 0: - print("Password receive failed.") - sys.exit(1) - sys.argv.append('-k') - sys.argv.append('Repository_' + acc[0] + '-remote:remotepass=' + output) - -sys.argv.append('-s') # output to syslog -sys.argv.append('-u') -sys.argv.append('syslog') - -with daemon.DaemonContext(): - check_running() - with open(pidfile, "w") as f: - f.write("%s" % os.getpid()) - OfflineImap().run() |