7
7

It's turned on for my account, and other email notifications work - I'm guessing it's some kind of cron job rather than being triggered by a web request? How do we enable them on our installation?

Thanks

James

asked 11 Apr '11, 05:45

James%20Crowley's gravatar image

James Crowley
41171315
accept rate: 40%


Just for the record,

python manage.py send_email_alerts

is all you need to run, once a day, from the root of your OSQA installation to get it to work from Windows (assuming your other email notifications are working fine). If it's not working and you're not getting any errors, go to

forum\\management\\commands\\send_email_alerts.py

and stick in some more logging.error("xyz") statements (and then checking the OSQA logs in the /log directory).

Hope that helps someone else!

link

answered 13 Apr '11, 17:19

James%20Crowley's gravatar image

James Crowley
41171315
accept rate: 40%

edited 13 Apr '11, 17:19

I think you need to add a cron job to call the relevant script in osqa/cron

Is your installation with webfaction, or somewhere else? I'm about to try to get it working at my webfaction account now.

If it is at webfaction, note that their install script doesn't update the osqa/cron script - you'll need to do that manually.

link

answered 11 Apr '11, 08:36

Andrew_S's gravatar image

Andrew_S ♦
5.6k45674
accept rate: 21%

edited 11 Apr '11, 08:49

I'm hosting it myself - but couldn't find any documentation relating to any cron scripts etc?

(11 Apr '11, 08:54) James Crowley

Ah, ok. Check out the README in the osqa/cron directory to start with. You'll need to set up a cron task to execute either send_email_alerts or send_email_alerts_virtualenv. You'll need to customise the file you are executing, to get it to work: insert the full path to python, to ensure that the cron task will be able to find it.

(11 Apr '11, 09:08) Andrew_S ♦

I've tried running

python manage.py send_email_alerts

from the console in the root of the OSQA site, and the command seemingly runs with no output. But I don't get any emails, or errors?

Any ideas?!

Thanks

(13 Apr '11, 15:47) James Crowley
3

Have you got your path variables set ok?

Here's what my cron task looks like, which might help:

#!/bin/sh

PYTHONPATH=/home/Andrew_S/webapps/osqa

export PYTHONPATH

PROJECT_ROOT=$PYTHONPATH/osqa

/usr/local/bin/python2.6 $PROJECT_ROOT/manage.py send_email_alerts

(13 Apr '11, 16:40) Andrew_S ♦

Andrew, I might be misunderstanding here, but I'm basically running that last line in the command console directly:

python manage.py send_email_alerts

which as far as I can understand does exactly the same. (I'm running on Windows so not exactly sure how to translate the rest). And like I say, no errors are generated. Thanks for your help with this, much appreciated.

(13 Apr '11, 16:44) James Crowley

Yeah, sorry, as I was editing my comment, I saw that I'd maybe misunderstood what was happening. Anything useful in any logs (smtp, django?)?

Does the test feature from Administration > Email Settings > E-Mail settings test work ok?

(13 Apr '11, 16:49) Andrew_S ♦
1

I did a bit more digging into the send_email_alerts.py file, added a bit more logging and established it's not sent anything because it doesn't think anything has happened in the last 24 hours. It turned out that's because there were only replies to existing topics rather than new ones.

So it actually works fine! Thanks for your help Andrew

(13 Apr '11, 17:17) James Crowley

@Andrew_S i tried running (from the command line) the command that is within your cron. it worked perfectly. so, i updated send_email_alerts with this command. i added /home/myusername/webapps/mywebapp/osqa/cron/send_email_alerts to my crontab. whenever it tries to run i get an email indicating: /bin/sh: /home/cpcadmin/webapps/mcs/osqa/cron/send_email_alerts: Permission denied Any idea why this might be?

(04 Jun '11, 11:52) rsp

what user is the cron task running as? What are the permissions on the send_email_alerts file?

(04 Jun '11, 13:24) Andrew_S ♦

@Andrew_S I'm new to this environment and cron so excuse the ignorance: I'm on webfaction and checked getfacl on send_email_alerts: ownwer:myusername group:myusername user::rw- group:rw- other:r-- i just did crontab -e to edit my crontab. i assume its running under myusername? trying to run send_email_alerts at the command line myself also returns permission denied. i'm not sure what permission i need to set?

(04 Jun '11, 15:34) rsp
1

I think what's going on is that it's not marked as executable, and you're trying to execute it. I think you want it as rwx r-x r--

(05 Jun '11, 03:48) Andrew_S ♦

Did someone make digest work with webfaction?

(11 Jun '11, 18:29) Sandro Dznel...
1

@Sandro I literally just figured it out. setting execute permissions on a file is what is necessary and the process is described here: http://docs.webfaction.com/software/static.html?highlight=cron%20permission%20denied#error-permission-denied.

(11 Jun '11, 18:48) rsp
showing 5 of 13 show 8 more comments

On Windows (Server 2008)


Create a batch (.bat) file with this inside: python {path to osqa}\manage.py send_email_alerts

Place this in the {path to osqa}\cron folder (or wherever you want).

Open Server manager and create a new scheduled task that calls your batch file.

In our case I had to run the task as Local System. Local Service and Network Service couldn't run it even with Read & Execute NTFS permissions granted on the cron folder...

link

answered 22 Mar, 13:46

HAL9000's gravatar image

HAL9000
6648
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×101
×10

Asked: 11 Apr '11, 05:45

Seen: 1,168 times

Last updated: 22 Mar, 13:46

powered by OSQA