My django project calls a python file at a scheduled time using "at" scheduler. This is executed within my models.py
command = 'echo "python /path/to/script.py params" | /usr/bin/at -t [time] &> path/to/at.log'
status = os.system(command)
Where [time] is schedule time. It works perfectly when I run it within Django Dev server (I usually run as root but it also works with other users as well) But when I deployed my application on Apache using mod_wsgi, it doesn't work. at logs shows that the job was schedule but it doesn't execute it. I tried everything from changing the ownership to www-data, permissions, made it into executable to all users, to setuid to root (Huge Security Issue) The last thing I want to do is run apache as root user.
atcommand only takes the name of the executable which is to be scheduled for execution with no parameters.echobasically forcesatto schedule the executable along with it's parameters. Look up the man page forat