带有通知发送的 Cron [英] Cron with notify-send

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

问题描述

我需要显示来自 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"

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

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