Notification how cron works

I encoded a python application that worked fine as a cron job. Later, I added several libraries (for example, pynotifyothers *), because I wanted to receive a notification with a message about what was happening, but it seems that cron cannot start such an application.

Do you know any alternative how to run this application every five minutes? I am using Xubuntu.

  • import gtk, pygtk, os, os.path, pynotify

I run the application without cron without any problems.

Cron seems to be launching the application, but it does not display a notification message. There /var/log/cron.logare no errors. The application ran every minute without any problems.

my crontab: */1 * * * * /home/xralf/pythonsrc/app

Thank you

+3
source share
4 answers

python script cron, , , cron. cronjob, cron

00 12 * * * LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib && export LD_LIBRARY_PATH && /path/to/my/script

.

+1

cron "", DISPLAY var (export DISPLAY =: 0), .

+1

cron pynotify? ?

Python , , Python , cron?

- , Python, .

Supervisord - cron, , 5 . , supervisord . , cron.

0

Your most likely problem is the path problem. Cron has no user paths unless you specifically configured it. Therefore, if your libraries are installed in non-standard locations or user accounts, cron will require full paths or you need to set the path variable in the crontab file.

Add line

PATH=/bin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/any/other/path

into your crontab file and see if it works.

0
source

All Articles