From ArchWiki
Jump to: navigation, search

getmail with systemd

The article states that cron is not in base anymore and systemd (timers) might be an option. The notice encourages a discussion, so I thought I start one. :) --BorisA (talk) 19:31, 18 November 2015 (UTC)

service for imap idle

Personally I run my main getmail with an IMAP-Idle connections, so instead of timers a normal systemd user-service is a good option, I found this blogpost to be helpful and did something similar. I have a file "~/.config/systemd/user/getmail-foo.service"

 Description=Get mails from foo
 ExecStart=/usr/bin/getmail --rcfile=foo.ini --idle=Inbox

and enabled it with

# systemctl --user enable getmail-foo.service

This way the service gets started after logging in and listens for changes in the folder "Inbox". For local imap the Unit could also set After/Wants to the service that provides imap (e.g. "dovecot.service"), which is what I do. I guess this wouldn't start dovecot if its not running, but at least it should check if dovecot is really running, but I haven't tested this yet. --BorisA (talk) 19:31, 18 November 2015 (UTC)


For some less important accounts I use getmail timers to start getmail regularly like cron does. I created two files for this in ~/.config/systemd/user/

 Description=Fetch mails                                                                                                                                              
 ExecStart=/usr/bin/getmail --rcfile=bar.ini --rcfile=baz.ini
 Description=Timer for getmail

and enabled the timer with

# systemctl --user enable getmail.timer

this starts getmail for the configurations "bar.ini" and "baz.ini" 1 minute after boot and then every 15 minutes. To see if it worked and when the next run is scheduled you can list the user timers (systemctl --user list-timers) --BorisA (talk) 19:31, 18 November 2015 (UTC)