aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlocal/sbin/syncemail22
m---------private0
-rw-r--r--profile4
3 files changed, 20 insertions, 6 deletions
diff --git a/local/sbin/syncemail b/local/sbin/syncemail
index d0ea682..dfd56a3 100755
--- a/local/sbin/syncemail
+++ b/local/sbin/syncemail
@@ -7,8 +7,17 @@ import daemon
import lockfile
from offlineimap import OfflineImap
-if os.path.isfile('/home/cynerd/.run/syncemail.pid.lock'):
- sys.exit(0)
+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"],
@@ -25,8 +34,11 @@ for acc in accounts:
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(
- pidfile=lockfile.FileLock('/home/cynerd/.run/syncemail.pid')
- ):
+with daemon.DaemonContext():
+ check_running()
+ with open(pidfile, "w") as f:
+ f.write("%s" % os.getpid())
OfflineImap().run()
diff --git a/private b/private
-Subproject 46aaf1f524abcecf87471bc1a6aafdbfaa1ef02
+Subproject 404e1b3305786aab9dfc7ef180d4aa3b64130ed
diff --git a/profile b/profile
index 8a59d6e..5db59d9 100644
--- a/profile
+++ b/profile
@@ -1,6 +1,8 @@
# Start pulse audio
-pulseaudio --start
+pulseaudio --start 2>/dev/null
# Start music player daemon
mpd ~/.config/mpd/mpd.conf
# Start email synchronization
~/.local/sbin/syncemail
+# Start syncthing
+start-stop-daemon -S -bm -p /tmp/syncthing-$UID.pid -- sh -c "syncthing -no-browser 2>&1 | logger -t syncthing"