【问题标题】:notify-send doesn't work in crontab (doesn't send a notification)notify-send 在 crontab 中不起作用(不发送通知)
【发布时间】:2014-05-21 21:08:16
【问题描述】:

我想制作一个小脚本,当 pacman 有可用更新时,它会向我发送通知。我做到了:

#!/bin/sh

while /usr/bin/inotifywait -e create /var/lib/pacman; do
/usr/bin/notify-send "pacmauto" "Updating...";
updateDone=0
while /usr/bin/inotifywait -e delete /var/lib/pacman -t 30; do
    updateDone=1;
done
if [ $updateDone -eq 1 ]; then
    /usr/bin/notify-send "pacmauto" "Update done, you can install it with pacman -Su";
fi
done

但事实是,当我在用户提示下使用它时,它可以工作。但是当我想把它放在一个 crontab 中时,它不会在完成后向我发送通知。有人可以帮助我吗?

【问题讨论】:

标签: bash unix cron notify pacman-package-manager


【解决方案1】:

所以最后,我关注了这个主题 (http://ubuntuforums.org/showthread.php?t=1533494),它现在可以工作了。谢谢你,Philibobby!

【讨论】:

  • 所以主要问题是让 cron 知道要使用哪个显示器。感谢您回来回答您自己的问题。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-10-11
  • 2019-05-28
相关资源
最近更新 更多