Are you sitting down? You could (gasp!) put the desired sleep time value in the file! Then read it when it's time to sleep, and use whatever value you find.I could do multiple "elif" lines with a variety of SLEEPDUR values. I could create the files (likely naming them the desired values) and move them in and out of the folder for them to be seen. The only issue I see is that if it is on a 6 hour cycle, then I would have to wait until that cycle is done for it to be changed to a different SLEEPDUR value.Just check if a text file exists at the end of time.sleep().Could I have it import the variable from another script that I could update without interrupting the running code?
If it does set SLEEPDUR = 43200
else set SLEEPDUR = 3600.So to create the file just use touch from the command lineCode:
from pathlib import Pathmy_file = Path("/path/to/file")if my_file.is_file():SLEEPDUR = 43200else:SLEEPDUR = 3600
Then when you are ready just delete it.
Statistics: Posted by ame — Fri Jan 24, 2025 9:20 pm