Periodic Tasks

Some times you want to run periodic tasks. Little Sense for example, periodically cleans the log files and deletes old backups. If you want to add your own periodic task then open up in the server folder and add a new static method in the Maintenance class.

def my_custom_task():
    # Your code here

Next we need to tell the server to add the task you have created to the cron background manager. Near the bottom of the Maintenance class there is a function called “update_crontab”. At the bottom add the following code:

def update_crontab():


    task = 'my_custom_task'
    job ='{venv}bin/python {script} --task {task}'.format(
    job.setall('0 0 * * *')

The section `job.setall('0 0 * * *')` is where you tell the cron service when and how ofter you want your task to run. See the [Python Crontab}( for more information on how to set these values.