Answer the question
In order to leave comments, you need to log in
Execute python script every 24 hours?
The task is next. The site is developed with django. There is a table with which you need to perform some operations every 24 hours.
With what help to implement?
I visited time.sleep, but I think it doesn't fit. I looked in the direction of cron, but did not understand how to start it.
Answer the question
In order to leave comments, you need to log in
https://docs.python.org/3/library/sched.html from the standard library, or a more convenient 3rd party https://pypi.python.org/pypi/schedule
Cron is very easy to set up. As the user on whose behalf you want to run the script, set up the crontab file
crontab -e
and add the line
0 0 * * *
which means - at zero second, zero hour (0:00), every day of the month, every month, every day of the week, execute command
Write a call to your script as a command.
Take care to specify the full path to the files.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question