我需要显示来自 cron 作业的通知。我的 crontab 是这样的:
$ crontab -l
# m h dom mon dow command
* * * * * Display=:0.0 /usr/bin/notify-send Hey "How are you"
我检查了/var/log/syslog
并且该命令实际上每分钟执行一次但它没有弹出通知。
谁能帮我理解为什么?
最佳答案
我在 Ubuntu 18.04 上使用 i3。我解决这个问题的方法是:
* * * * * XDG_RUNTIME_DIR=/run/user/$(id -u) notify-send 嘿“这是狗!”
编辑 2020:我仍然在 Ubuntu 20.04 上使用它。
关于linux - 带有通知发送的 Cron,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16519673/