问题原文
原帖链接 · guettli · CC BY-SA 4.0
Up to now we get new mails with the tool getmail.
It works well. There is a cron job which runs every minute.
Is there a way to get the mail faster?
I see two ways:
- Solution 1: run the cron job every 30 seconds
- Solution 2: maybe use IMAP idle. I means a more daemon like way, not a CLT which gets called every minute.
- Solution 3: ???
Solution 1 is simple:
* * * * * getmail; sleep 25; getmail
Better solutions are welcome.
Protocol: IMAP
已采纳解答
原帖链接 · Stefan Seidel · CC BY-SA 4.0
getmail seems to support IMAP IDLE. So you can write a simple systemd job:
[Unit]
Description=Starts getmail
After=network.target
[Service]
ExecStart=/usr/bin/getmail --idle=INBOX
Restart=on-failure
[Install]
WantedBy=multi-user.target
Put it in /etc/systemd/system/getmail-idle.service and run systemctl enable --now getmail-idle.
Of course you may need to add stuff like User= and parameters to getmail that you need tailored for you.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
