Hello everybody :)
## Short description, what i'm searching for: I want to have a detached tmux session automatically started as a systemd user service. Inside that, offlineimap should start and decrypt my login credentials. The graphical variant of pinentry should ask me for the password for decrypting my login credentials, when I attach to the session. For managing my login credentials, I use the program 'pass' ( https://www.passwordstore.org/ ).
## What I've got so far: The desired Behavior works perfectly and reproducibly (starting from reboot), when i start the user service after I've logged into my system.
But unfortunately it doesn't work when I do "symstemctl --user enable mail.service" and reboot:
$ systemctl --user status mail ● mail.service - load offlineimap for all mail accounts inside tmux Loaded: loaded (/home/toogley/.dotfiles/systemd/user/mail.service; enabled; vendor preset: enabled) Active: inactive (dead)
$ tmux attach-session -t mail can't find session mail
I have no idea, what i could analyze or what might be the reason. Does somebody has tips how to address this issue?
Thanks a lot!
Tobias/toogley
#=======[ mail.service ]======== Description=load offlineimap for all mail accounts inside tmux After=network.target graphical.target Requires=gpg-agent.service
[Service] Type=oneshot RemainAfterExit=yes ExecStart=/usr/bin/tmux new-session -d -s mail -n dev 'export GPG_TTY=$(tty) && \ offlineimap' ExecStop=/usr/bin/tmux kill-window -t mail ExecReload=/usr/bin/kill -s USR1 $(pgrep offlineimap)
[Install] WantedBy=graphical.target #--------------------------------------------------------- #=======[ gpg-agent service ]======== [Unit] Description=GnuPG private key agent IgnoreOnIsolate=true
[Service] Type=forking ExecStart=/usr/bin/gpg-agent --daemon --homedir=%h/.gnupg ExecStop=/usr/bin/pkill gpg-agent Restart=on-abort
[Install] WantedBy=default.target #---------------------------------------------------------
#========[ ~/.offlineimaprc ]====== [general] accounts = dev ui = ttyui metadata = ~/.dev_offimap pythonfile=~/.dotfiles/mutt/accounts/decrypt.py
[Account dev] synclabels = yes localrepository = dev-local remoterepository = dev-remote status_backend = sqlite autorefresh = 1 quick = 10
[Repository dev-local] type = Maildir localfolders = ~/mail/dev/
[Repository dev-remote] remotepasseval = get_pass("toogley@mailbox.org") ssl = yes type = IMAP remotehost = imap.mailbox.org remoteuser = toogley@mailbox.org sslcacertfile = /etc/ssl/certs/ca-bundle.crt keepalive = 60 holdconnectionopen = yes #---------------------------------------------------------