I found a way to do this. It has one negative side - it is impossible to indicate the current year, and the task will be launched again in a year. But usually the server restarts more often, then this period.
from celery.task import PeriodicTask class InitialTasksStarter(PeriodicTask): starttime = datetime.now() + timedelta(minutes=1) run_every = crontab(month_of_year=starttime.month, day_of_month=starttime.day, hour=starttime.hour, minute=starttime.minute) def run(self, **kwargs): .... return True
source share