From 8d39ed9e2804c6c9ed42aa685f6eb2f7c38fbbea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sat, 8 Apr 2017 21:53:52 +0200 Subject: Fix syncemail (option -s is gone) --- install | 1 + local/sbin/syncemail | 10 +++++++--- private | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/install b/install index 46a5d3c..5616075 100755 --- a/install +++ b/install @@ -59,6 +59,7 @@ fi read -p "Install email synchronization? (Y/n) " if [[ $REPLY =~ ^[Yy]?$ ]]; then inst local/bin/email-unread ~/.local/bin/email-unread + inst local/sbin/newmail-notify ~/.local/sbin/newmail-notify inst_email_sync # Contains: # inst local/sbin/syncemail ~/.local/sbin/ diff --git a/local/sbin/syncemail b/local/sbin/syncemail index dfd56a3..3cb56a4 100755 --- a/local/sbin/syncemail +++ b/local/sbin/syncemail @@ -5,6 +5,7 @@ import sys import subprocess import daemon import lockfile +import syslog from offlineimap import OfflineImap pidfile = '/tmp/syncemail-%d.pid' % os.getuid() @@ -33,12 +34,15 @@ for acc in accounts: 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') +# 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() diff --git a/private b/private index 3f5aa66..3b11f0b 160000 --- a/private +++ b/private @@ -1 +1 @@ -Subproject commit 3f5aa66bb2c6b888958356385bcb23813b5ec15a +Subproject commit 3b11f0bb0bce7f594ee4ba1dddc1aea8bdeb5cc5 -- cgit v1.2.3