You are not logged in.
Pages: 1
Topic closed
I have offlineimap setup to run as a daemon. It doesn't correctly resume operations after a resume from suspend to RAM without being restarted. The 'Conflicts=' line in the service file makes sure it is stopped when the machine suspends, but I can't figure out how to get it restarted again. Here is the service file:
[Unit]
Description=Start offlineimap as a daemon
Requires=network.target
Conflicts=suspend.target
After=network.target
[Service]
User=%i
EnvironmentFile=/home/%i/.gnupg/gpg-agent-info
ExecStart=/usr/bin/offlineimap
KillSignal=SIGUSR2
Restart=always
RestartSec=15
[Install]
WantedBy=multi-user.target
I found an email thread here that seemed to imply that I could add sleep.target to 'WantedBy=' and sleep.target to 'After=' to get service to startup again after resume, but that didn't seem to work.
Any ideas? Thanks!
Scott
Last edited by firecat53 (2014-07-01 16:40:20)
Offline
I think that by using Conflicts= will cause the service to be semi-permanently disabled. I take it you used 'Conflicts=sleep.target' and 'WantedBy=sleep.target' which is a conflict in itself.
Ditch the conflict method and use a WantedBy for both a start and stop service of offlineimap. So you have three services:
- one handles offlineimap
- one handles stopping offlineimap before suspend
- one handles starrting offlineimap after suspend
That is the best I can come up with. Would be nice if a feature exists that would do this for you...
fs/super.c : "Self-destruct in 5 seconds. Have a nice day...\n",
Offline
More information here on Lennart's thoughts about a resume.target. Also based on that thread and my own existing resume/suspend services, I went ahead and created offlineimap-resume@.service:
[Unit]
Description=Restart offlineimap after resume
After=suspend.target
[Service]
Type=simple
ExecStart=/usr/bin/systemctl --no-block restart offlineimap@%i.service
[Install]
WantedBy=suspend.target
So, I'll mark this as solved. If anyone has a better/cleaner approach that actually uses only the service/unit file directives to accomplish this within a single service file, please let me know!
Thanks,
Scott
Offline
It doesn't correctly resume operations after a resume from suspend to RAM without being restarted.
Is this just something you have observed on your own system, or is it a known bug?
Offline
firecat53 wrote:It doesn't correctly resume operations after a resume from suspend to RAM without being restarted.
Is this just something you have observed on your own system, or is it a known bug?
Something I noticed and figured it was just due to frequently switching networks with VPN on/off again. After a quick search, I discovered the 'socktimeout' option, which I'm testing now to see if that solves the problem. It appears (although I _just_ found this, that it is a known bug. Some have had luck with setting socktimeout, others haven't. I'll post back if I see a difference or not.
Thanks for the nudge
Scott
Offline
Well after several days of testing, offlineimap as a daemon is working great through suspend-resume cycles with no stop-restart systemd trickery required. I'm not sure if the socktimeout made the difference, or if I just didn't test it enough at first.
Scott
Offline
This https://www.rockyourcode.com/how-to-res … r-suspend/ one was also helpful for me
Offline
Pages: 1
Topic closed