Нет описания

Lukas Angerer d4aa60a4f5 Delayed service restart to avoid hammering the logs with errors 8 месяцев назад
CronAlarm 5d61803d90 Update to .NET 9 8 месяцев назад
data 6d55a30eea Running cron trigger scripts in situ 8 месяцев назад
scripts ae1c83df00 Added missing cron trigger scripts 8 месяцев назад
service-units d4aa60a4f5 Delayed service restart to avoid hammering the logs with errors 8 месяцев назад
.dockerignore 0ee09dd3b6 Initial commit 5 лет назад
.gitignore 6d55a30eea Running cron trigger scripts in situ 8 месяцев назад
CronAlarm.sln 5eb30d2c45 Cleanup and configuration layering 5 лет назад
DESCRIPTION 72b33274a3 Added description file 5 лет назад
Dockerfile 5d61803d90 Update to .NET 9 8 месяцев назад
LICENSE 790390c9c9 README and cleanup 5 лет назад
README.md 790390c9c9 README and cleanup 5 лет назад
docker-compose.yml 2ff5947aa3 Explicitly using ARM32 build for running on musicbox Raspberry Pi 8 месяцев назад

README.md

CronAlarm

Configuration based web UI to manage sections of a crontab

The main application is a Blazor (server) frontend that presents an alarm selection UI based on appsettings.json. The .NET 5 application is meant to run in a container and communicates with the host system through a separate Python 3 Flask API that creates a thin wrapper for actually reading and writing the crontab through crontab -l and crontab -.

The configuration consists of two layers:

  • The core settings that define the general application parameters
  • A secondary configuration placed in the wwwroot/data directory that contains the actual alert configuration

Building

In the root of the project, simply execute

docker-compose build

This will build the application and construct a tagged container image for running it.

Running

Still in the root of the project, run

docker-compose up

This runs the container and mounts the ./data directory as /app/wwwroot/data which means that the ./data/settings.json file in that directory will be used for the alert configuration.

And for running the Flask API on the host - assuming that you have Python3 and Flask installed

./scripts/cron-api.py

Configuration

The base appsettings.json configuration defines the base URI of the Flask Python web API running on the host system. The URI must of course be resolvable from within the container that runs the Blazor frontend.

{
  "CronApi": {
    "BaseUri": "http://192.168.42.44:5000"
  }
}

The main alert configuration is split into groups. All alerts use the same command, so that is defined on the top level of Alerts.Command.

{
  "Alerts": {
    "Command": "/home/pi/mpc-alarm-cron.sh",
    "Groups": [
        // ...
    ]
  }
}

In every alert group at most one alert can be selected at any given time. The group must have a Name and a list of Options where each option defines a human readable Label and the corresponding cron Pattern. When a specific option is selected, the pattern is combined with the command and will be added as a line to the crontab.

{
  "Name": "Weekdays",
  "Options": [
    {
      "Label": "06:20 - Work",
      "Pattern": "20 06 * * MON-FRI"
    },
    {
      "Label": "08:30 - Holidays",
      "Pattern": "30 08 * * MON-FRI"
    },
    {
      "Label": "09:00 - Sleeping In",
      "Pattern": "00 09 * * MON-FRI"
     }
  ]
}