The Lino Daemon

This document explains how to install linod as a service on a production server.


A Lino application can declare background tasks. Such tasks run in the background, i.e. in another process than the web server. That other process runs the linod admin command.

To enable the Lino Daemon, you must set use_linod to True. This can be done by a system admin in a local file.

The linod command will simply do nothing as long as this is False.

As an application developer you define background tasks using dd.schedule_often and dd.schedule_daily. For example the send_pending_emails_often and clear_seen_messages of the lino.modlib.notify plugin.


Starts a long-running process that runs scheduled background tasks.

On a development machine you simply run this in a separate terminal. On a production server we recommend to run this as a daemon via Supervisor as described below.

This command does nothing when use_linod is False.

Requires the schedule package

This feature requires Dan Bader's schedule package, which will get installed automatically if you run install.

Note the nice story of that package by its author : In Love, War, and Open-Source: Never Give Up

Activating the feature

>>> from atelier.sheller import Sheller
>>> shell = Sheller("lino_book/projects/roger")
>>> shell("python linod --list")
This site does not use linod.

As a system administrator you can check whether your application has scheduled background jobs by issuing the following command in your project directory:

$ python linod --list

For example in the team demo project there are 7 jobs:

>>> shell = Sheller("lino_book/projects/team")
>>> shell("python linod --list")
7 scheduled jobs:
[1] Every 1 day at 20:00:00 do checksummaries() (last run: [never], next run: ...)
[2] Every 1 day at 20:00:00 do checkdata() (last run: [never], next run: ...)
[3] Every 10 seconds do send_pending_emails_often() (last run: [never], next run: ...)
[4] Every 1 day at 20:00:00 do send_pending_emails_daily() (last run: [never], next run: ...)
[5] Every 1 day at 20:00:00 do clear_seen_messages() (last run: [never], next run: ...)
[6] Every 3600 seconds do update_all_repos() (last run: [never], next run: ...)
[7] Every 10 seconds do get_new_mail() (last run: [never], next run: ...)

Installation instructions

This section has become useless because these things are now done automatically by getlino.

  • Install the Supervisor package:

    $ sudo apt install supervisor

    The supervisor package is being installed system-wide, it is not related to any specific project.

  • Create a shell script in your project directory:

    set -e  # exit on error
    cd /path/to/myprj
    . env/bin/activate
    exec python linod

    Note: the exec command is needed here in order to avoid #1086. Thanks to Paul Lockaby

  • Create a file linod_myprj.conf in /etc/supervisor/conf.d/ with this content:

    command = /path/to/myprj/
    username = www-data
    umask = 002
  • Restart supervisord:

    $ sudo service supervisor restart
  • Have a look at the log files in /var/log/supervisor.