aboutsummaryrefslogtreecommitdiff
path: root/local/sbin
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2020-06-25 14:41:17 +0200
committerKarel Kočí <cynerd@email.cz>2020-06-25 14:41:17 +0200
commit5b32edcf88fe0b952100547b1b26f2eda15d47f1 (patch)
tree96b48c68405607451b14cb9e7ea091be1a4a9bcd /local/sbin
parentc76a1f17761b8b0787a8f142ca73dd69d6737387 (diff)
downloadmyconfigs-5b32edcf88fe0b952100547b1b26f2eda15d47f1.tar.gz
myconfigs-5b32edcf88fe0b952100547b1b26f2eda15d47f1.tar.bz2
myconfigs-5b32edcf88fe0b952100547b1b26f2eda15d47f1.zip
Replace offlineimap with isync
Diffstat (limited to 'local/sbin')
-rwxr-xr-xlocal/sbin/syncemail48
1 files changed, 0 insertions, 48 deletions
diff --git a/local/sbin/syncemail b/local/sbin/syncemail
deleted file mode 100755
index 3cb56a4..0000000
--- a/local/sbin/syncemail
+++ /dev/null
@@ -1,48 +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
-import syslog
-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)
-
-# Define out logger and redirect stdout and stderr to it
-class logstd:
- def write(self, data):
- syslog.syslog(data)
-
-with daemon.DaemonContext():
- check_running()
- with open(pidfile, "w") as f:
- f.write("%s" % os.getpid())
- syslog.openlog('syncemail')
- sys.stderr = sys.stdout = logstd()
- OfflineImap().run()