My django project calls a python file in a scheduled time using "at" scheduler. This really is performed inside my

command = 'echo "python /path/to/ params" | /usr/bin/at -t [time] &> path/to/at.log'
status = os.system(command)

Where [time] is schedule time. It really works perfectly after i run it within Django Dev server (It's my job to run as root it works together with other customers too) However when I used my application on Apache using mod_wsgi, it does not work. at logs implies that the task was schedule however it does not carry it out. I attempted from altering the possession to world wide web-data, permissions, managed to get into executable to any or all customers, to setuid to root (Huge Security Problem) The final factor I wish to do operates apache as root user.

Use cron or celery for scheduled tasks. If you want to run something as root, it'd seem sensible to re-write your script like a simple daemon and run that as root, you are able to pass instructions into it pretty easily with zeromq.