Operations
CLI
Inspect jobs, trigger runs and read logs from the terminal.
Invoking the CLI
The CLI is a module, run with python -m:
python -m fastapi_crons.cli --helpThere is no fastapi-crons console script
The package does not install a standalone fastapi-crons command, and python -m fastapi_crons does not work either — there is no __main__ module. Always use python -m fastapi_crons.cli.
Commands
| Command | Purpose |
|---|---|
list-jobs | List registered jobs with their status. |
run-job NAME | Run one job immediately. |
status | Overall system status. |
logs | Show job execution logs. |
config-show | Print the active configuration. |
config-set | Set a configuration value. |
start-scheduler | Run the scheduler without a web server. |
Every command accepts --help for its own options.
Examples
python -m fastapi_crons.cli list-jobs
python -m fastapi_crons.cli run-job backup_database
python -m fastapi_crons.cli status
python -m fastapi_crons.cli logs --job backup_database
python -m fastapi_crons.cli config-show
python -m fastapi_crons.cli start-schedulerThe CLI reads the same state as your app
It connects to the state backend configured through the environment, so it reports what your running application recorded. Point it at the same CRON_SQLITE_DB_PATH or CRON_REDIS_URL your app uses, or it will read an empty database and show nothing.
Jobs must be importable to be listed
Job definitions live in your application code. Run the CLI from the same working directory and virtual environment as your app so the module that registers them can be imported.
Running the scheduler without a web server
start-scheduler runs the job loops on their own, which is useful if you want scheduled work in a dedicated process rather than inside your API replicas.
python -m fastapi_crons.cli start-scheduler