【发布时间】: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 中时,它不会在完成后向我发送通知。有人可以帮助我吗?
【问题讨论】:
-
也许你会发现这很有用:ubuntuforums.org/showthread.php?t=1533494
-
谢谢,现在解决了!
-
我建议您在下面添加答案,以便人们在此线程上找到解决方案!
标签: bash unix cron notify pacman-package-manager