A basic automation framework for running tasks on an interval. Useful for things like periodically accessing an API, sending daily emails, etc
- Install .NET 6 if you do not have it installed already
- Clone the repo
- Run
dotnet build
- Running the resulting executable will run the example tasks
To set up your own library of tasks:
-
Create a folder (ideally, not inside the ClockworkFramework folder)
-
Run
dotnet new console
-
Run
dotnet add package ClockworkFramework.Core
-
Add one or more classes that implement
IClockworkTaskBase
and a method with the[TaskMethod]
&[Interval(..)]
attributes (see Examples)For some common needs like calling an API or running a process you can use the
Utilties
class. See ExampleApiTask -
In the same directory as ClockworkFramework.exe create
config.json
. Here is an annotated example:
{
"repositoryUpdateFrequency" : 5, // How often to update each library's repository (if it is a git repository) in minutes
"libraries" : [
{
"path" : "..\\..\\ClockworkTasks", // The path to the library. Can be relative or absolute. Can be a folder (containing a csproj), a csproj, or a dll
"updateRepository" : true // Whether to update the repository (with `git pull`) on the cadence in repositoryUpdateFrequency
}
]
}
- Run the ClockworkFramework.exe to load your new library