Skip to content
Branch: master
Find file History
rkdarst cull-idle: Include a hint on how to add custom culling logic
- gets the full server state, so is capable of
  doing any kind of arbitrary logic on the profile in order to be more
  flexible in culling.
- This patch does not change anything, but gives an embedded
  (commented out) example of how you can easily add custom logic to
  the script.
- This was added as a tempate/demo for #2598.
Latest commit a6b7e30 Jun 16, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.

cull-idle Example

The file provides a script to cull and shut down idle single-user notebook servers. This script is used when cull-idle is run as a Service or when it is run manually as a standalone script.

Configure cull-idle to run as a Hub-Managed Service

In, add the following dictionary for the cull-idle Service to the list: = [
        'name': 'cull-idle',
        'admin': True,
        'command': [sys.executable, '', '--timeout=3600'],


  • 'admin': True indicates that the Service has 'admin' permissions, and
  • 'command' indicates that the Service will be managed by the Hub.

Run cull-idle manually as a standalone script

This will run cull-idle manually. cull-idle can be run as a standalone script anywhere with access to the Hub, and will periodically check for idle servers and shut them down via the Hub's REST API. In order to shutdown the servers, the token given to cull-idle must have admin privileges.

Generate an API token and store it in the JUPYTERHUB_API_TOKEN environment variable. Run manually.

    export JUPYTERHUB_API_TOKEN=$(jupyterhub token)
    python3 [--timeout=900] [--url=]
You can’t perform that action at this time.