如何通过“notify-send”和“crontab”在ubuntu18.04上设置通知?

问题描述 投票:-1回答:2

以下是crontab -e的设置,但它不起作用。

*/20 * * * * export DISPLAY=:0.0;/usr/bin/notify-send "Take A Rest Please!" "Pay attention to your Eyes and Neck!" 
ubuntu
2个回答
0
投票

以下是一些可用于解决crontab问题的基本步骤:

  1. 让你的crontabs运行更频繁(每分钟一次):

* * * * * export DISPLAY=:0.0 && /usr/bin/notify-send "Take A Rest Please!" "Pay Attention to your Eyes and Neck!"

那个适用于我的ubuntu 18。

  1. 检查你的cron日志

您可以使用以下命令执行此操作:

/var/log/syslog

要么

grep CRON /var/log/syslog

0
投票

尝试你的系统设置,在通知部分:启用'通知弹出窗口'我有同样的问题,并以这种方式解决它

***更新:检查你是否安装了notify-osd软件包(sudo apt install notify-osd)

© www.soinside.com 2019 - 2024. All rights reserved.