通知发送没有出现在暴发户
notfiy-send not showing up with upstart
问题:即使创建了日志文件,notify-send 命令也没有显示通知。
/home/user/test
的内容
#!/bin/bash
echo 'test job, reporting...'
while :
do
notify-send 'This is a simple notification Sir'
sleep 30
done
/etc/init/myjob.conf
的内容
description "test job"
start on runlevel [2345]
exec /home/sajal/test
检查语法错误:
$ init-checkconf myjob.conf
为了 运行 我使用了上面的 .config 文件:
$ sudo start myjob
查看生成的日志内容:
$ sudo gedit /var/log/upstart/myjob.log
这根本不是暴发户的问题。您正在尝试发送 Desktop Notifications using system job,它在没有引用您的桌面会话的环境中执行,即它缺少 DBUS_SESSION_BUS_ADDRESS
和 DISPLAY
以及其他环境变量。
您可以使用我们session job instead (recommended) or gain understanding on Linux permissions, session and environments and define needed enviromental variables in your system job configuration file. You might find some useful hints in those two threads related to sending desktop notifications from system cron job. 1 and 2
问题:即使创建了日志文件,notify-send 命令也没有显示通知。
/home/user/test
的内容#!/bin/bash
echo 'test job, reporting...'
while :
do
notify-send 'This is a simple notification Sir'
sleep 30
done
/etc/init/myjob.conf
的内容description "test job"
start on runlevel [2345]
exec /home/sajal/test
检查语法错误:
$ init-checkconf myjob.conf
为了 运行 我使用了上面的 .config 文件:
$ sudo start myjob
查看生成的日志内容:
$ sudo gedit /var/log/upstart/myjob.log
这根本不是暴发户的问题。您正在尝试发送 Desktop Notifications using system job,它在没有引用您的桌面会话的环境中执行,即它缺少 DBUS_SESSION_BUS_ADDRESS
和 DISPLAY
以及其他环境变量。
您可以使用我们session job instead (recommended) or gain understanding on Linux permissions, session and environments and define needed enviromental variables in your system job configuration file. You might find some useful hints in those two threads related to sending desktop notifications from system cron job. 1 and 2