How to change default path of Celery beat service?

If you executed celery -A your.project.app beat --help it would print you very useful CLI help where you would find the solution to your problem - the -s <path to the scheduler database file> flag.

-s SCHEDULE, --schedule SCHEDULE
                      Path to the schedule database. Defaults to celerybeat-
                      schedule. The extension '.db' may be appended to the
                      filename. Default is celerybeat-schedule.

All you have to do is to pass a full path to the schedule database file to your Celery beat process. Example: -s C:/services/celery/celerybeat-schedule.db


Finally I am able to change path of celery services using below code.

command = '"{celery_path}" -A {proj_dir} beat -f "{log_path}" -l info --pidfile="{pid_path}" '.format(
            celery_path=os.path.join(PYTHONSCRIPTPATH, 'celery.exe'),
            proj_dir=PROJECTDIR,
            # log_path_1=os.path.join(INSTDIR,'celery_2.log')),
            log_path=os.path.join(CELERYDIR,'celery_'+cur_date_time+'.log'),
            # bak_path=os.path.join(CELERYDIR,'celerybeat-schedule'),
            pid_path = os.path.join(CELERYDIR,'celerybeat_'+cur_date_time+'.pid'))

Tags:

Python

Celery