I have a python Daemon that runs continuously and hopefully never stops. It's being monitored by supervisord. However when the current date switches to the following day the following variable stays as yesterday's date:
today = datetime.date.today().strftime("%Y%m%d") Any ideas on how to correct this and make the date keep up? The current workaround is to schedule a cron task to restart the service and it grabs the new date. Even though that takes a few seconds it could interrupt the users so I want to come up with a better solution.
31 Answer
Variable assignments don't auto-magically update themselves.
Why not simply re-run the statement you showed each time you might need to refer to the current date? Or perhaps on each pass through your main loop, if you're referring to it thousands of times a second and repeated calls might degrade performance.
2