1

I have the following python file called temp.py

import subprocess
   p = subprocess.Popen('growlnotify -m \"Program is not running\"', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 
   retval = p.wait()
   print "end"

it works fine from the command line with 'python temp.py' and `sudo python temp.py' (all it needs to do is display the growl notification)

I open up crontab with 'crontab -e' (i'm on OSX if that helps. I add the line

  • 8-23 * * * python /Users/xxx/Dropbox/scripts/temp.py >> /Users/xx/running.txt

I expect the program to execute every minute from 8am to 23pm - and it does, the 'running.txt' file is filling up - but I'm not getting the growl notifications - any ideas?

  • 1
    It might not be possible to execute growlnotify from there because growl is dependent on the graphical environment (and more?). Check your log files for errors. – ggustafsson Dec 28 '12 at 6:13
1

The default path in crontab is /usr/bin:/bin. If you installed growlnotify somewhere else like /usr/local/bin/, you have to specify the full path in the script.

  • Yep - although it was the combination of this answer and the comment that got me there. – Joe Dec 28 '12 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.