Cron与notify-send [英] Cron with notify-send

查看:177
本文介绍了Cron与notify-send的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要显示来自cron作业的通知。我的crontab是:

I need to show a notification from a cron job. My crontab is something like:

$ crontab -l
# m h  dom mon dow   command
  * *   *   *   *    Display=:0.0 /usr/bin/notify-send Hey "How are you"

我检查了 / var / log / syslog ,该命令实际上是每分钟执行一次,但它不弹出通知。
任何人都能帮助我理解为什么?

I checked /var/log/syslog and the command is actually executed every minute but it doesn't pop up the notification. Can anybody help me understand why?

推荐答案

我找到了答案:

$ crontab -l
# m h  dom mon dow   command
  * *   *   *   *    export DISPLAY=:0.0 && export XAUTHORITY=/home/ravi/.Xauthority && sudo -u ravi /usr/bin/notify-send Hey "How are you"

谢谢,
Ravi

Thanks, Ravi

这篇关于Cron与notify-send的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆