I want to run a program that runs a function every 4 hours. What is the least capable way to do this?
The easiest way I can think of (in python, since the post is tagged with python):
import time while True: do_task() time.sleep(4 * 60 * 60) # 4 hours * 60 minutes * 60 seconds
You can use schedmodule
sched
Here are the docs
https://docs.python.org/3.4/library/sched.html
Use the built-in timer:
from threading import Timer def function_to_be_scheduled(): """Your CODE HERE""" interval = 4 * 60 * 60 #interval (4hours) Timer(interval, function_to_be_scheduled).start()
Source: https://habr.com/ru/post/1745863/More articles:Using a variable name in XMLHttpRequest - jqueryTroubleshoot Silverlight ChildWindow Memory Leak - silverlightSWT ScrolledComposite disables information. - javaHow can I call a Perl routine from Flex? - flexTCP failure detection due to untrusted network - javaClient Side Session Redirection in ASP.Net - asp.netSwitching Data in ReportViewer in WinForms - c #Do you know about the free .Net component for graphic design and graphic stream editing? - c #Using Uncle Bob's code ideas in real-world code - objective-cThe JSF form is not submitted when the form is disabled by JavaScript. - javaAll Articles