【发布时间】:2016-04-03 13:30:28
【问题描述】:
这是我用于通知发送的 python 脚本:
#! /usr/bin/env python
import os
mstr='The scoreis 102/3'
title="SCORE"
os.environ.setdefault('DISPLAY', ':0.0')
os.system('notify-send -i "notification-message-IM" "'+title+'" "'+mstr+'"')
当我运行脚本时它可以正常工作,但是当我尝试从 cron 运行它时它不起作用
我已尝试从此链接中引用: Cron scheduler of python script using notify-send
即使在 crontab 中,我也尝试过像这样运行通知发送命令:
* * * * * export DISPLAY=:0.0 && /usr/bin/notify-send "How are you"
但无济于事。
有什么我做错的地方请指教。
【问题讨论】: