aboutsummaryrefslogtreecommitdiff
path: root/local/sbin/syncemail
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2017-04-08 21:53:52 +0200
committerKarel Kočí <cynerd@email.cz>2017-04-08 21:53:52 +0200
commit8d39ed9e2804c6c9ed42aa685f6eb2f7c38fbbea (patch)
tree0cd5229ef0a98a1cb132ab2eb708a61b2c987af7 /local/sbin/syncemail
parent5466e3d6599181f07ea5824b0eba22d0c333dc3f (diff)
downloadmyconfigs-8d39ed9e2804c6c9ed42aa685f6eb2f7c38fbbea.tar.gz
myconfigs-8d39ed9e2804c6c9ed42aa685f6eb2f7c38fbbea.tar.bz2
myconfigs-8d39ed9e2804c6c9ed42aa685f6eb2f7c38fbbea.zip
Fix syncemail (option -s is gone)
Diffstat (limited to 'local/sbin/syncemail')
-rwxr-xr-xlocal/sbin/syncemail10
1 files changed, 7 insertions, 3 deletions
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()