大网数据广告活动
服务器运维问答

Get new mails immediately

· 52CE 我爱测

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…

问题原文

原帖链接 · 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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-09-14)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。