There are better ways to cut short your time to execute or even schedule
tasks or commands.

It won't take you more than an hour to understand Django-celery for
scheduling tasks. You need to create a bash script and it should include
all the steps in case you need virtualenv loaded while command runs. This
way you can schedule tasks for multiple django projects on same machine.

mybashscript.sh:

cd /var/www/website/
source myenv/bin/activate
/var/www/website/manage.py $1 --settings$2

Then in your contrab for cronjobs you can set it up like:

MAILTO=youradminacco...@yourwebsite.com
SETTINGSMODULE=yourwebsite.settings_production
5 * * * * /var/www/yourwebsite/mybashscript.sh fs_cli -x $SETTINGSMODULE >>
/dev/null

Each time your script runs you will get notified by email about the
schedule process.

Otherwise if you still want to get it executed by the python script. I
would suggest you to create a script.py at place of your settings.py and
import timezone. Then you can write the way or when you want to get it
executed by shell. You can search the best and simplest scheduling script
that fits your need.

Hope answer was helpful.

Regards,
Mudassar

On Mon, Aug 8, 2016 at 2:33 AM, Asad ur Rehman <asadurrehman...@gmail.com>
wrote:

> I want to run *fs_cli -x *command in django . Can anybody help me ?
> How can i create function in django to execute this command ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/0f9ea28d-37c9-40f2-b67a-b566c3691998%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/0f9ea28d-37c9-40f2-b67a-b566c3691998%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANoUts4VqBRe8wo9VF%3DyBRupDVoh7vF9SLyjem5F_HXeDcdJJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to