IceCoffee.Cron 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package IceCoffee.Cron --version 1.0.1                
NuGet\Install-Package IceCoffee.Cron -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IceCoffee.Cron" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IceCoffee.Cron --version 1.0.1                
#r "nuget: IceCoffee.Cron, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install IceCoffee.Cron as a Cake Addin
#addin nuget:?package=IceCoffee.Cron&version=1.0.1

// Install IceCoffee.Cron as a Cake Tool
#tool nuget:?package=IceCoffee.Cron&version=1.0.1                

IceCoffee.Cron

Package NuGet Stable Downloads
IceCoffee.Cron IceCoffee.Cron IceCoffee.Cron

Description

IceCoffee.Cron is a simple C# library for running tasks based on a cron schedule.

Installation

$ dotnet add package IceCoffee.Cron

Cron Schedules

IceCoffee.Cron supports most cron scheduling. See tests for supported formats.

*   *   *   *   *   *                         Allowed values     Allowed special characters     Comment
┬   ┬   ┬   ┬   ┬   ┬
│   │   │   │   │   │
│   │   │   │   │   │
│   │   │   │   │   └────── day of week       0 - 6  or SUN-SAT  * , - /                        Both 0 and 7 means SUN
│   │   │   │   └────────── month             1 - 12 or JAN-DEC  * , - /                      
│   │   │   └────────────── day of month      1 - 31             * , - /                      
│   │   └────────────────── hour              0 - 23             * , - / L W ?                
│   └────────────────────── min               0 - 59             * , - /                      
└────────────────────────── second (optional) 0 - 59             * , - / # L ?                  
Expression Description
*/1 * * * * * Every second
* * * * * Every minute
0 0 1 * * At midnight, on day 1 of every month
*/5 * * * * Every 5 minutes
30,45-15/2 1 * * * Every 2 minute from 1:00 AM to 01:15 AM and from 1:45 AM to 1:59 AM and at 1:30 AM
0 0 * * MON-FRI At 00:00, Monday through Friday
0 * * * * Every minute
0,1,2 * * * * Top of every hour
*/2 * * * * Every hour at minutes 0, 1, and 2
1-55 * * * * Every minute through the 55th minute
* 1,10,20 * * * Every 1st, 10th, and 20th hours2

Console Example

using IceCoffee.Cron;

namespace Demo
{
    internal class Program
    {
        static void Main(string[] args)
        {
            // Create CronDaemon instance
            var daemon = new CronDaemon();

            // Add jobs
            daemon.AddJob(new CronJob(
                "Job1",
                "*/1 * * * * *", // Run every second
                () =>
                {
                    Console.WriteLine($"Job1 executed at {DateTime.Now}");
                }));

            daemon.AddJob(new CronJob(
                "Job2",
                "*/5 * * * * *", // Run every 5 seconds
                async () =>
                {
                    Console.WriteLine($"Job2 executed at {DateTime.Now}");
                    await Task.Delay(100); // Simulate job execution
                }));

            daemon.AddJob(new CronJob(
                "Job3",
                "0 */1 * * * *", // Run at the 0th second of every minute
                async () =>
                {
                    Console.WriteLine($"Job3 executed at {DateTime.Now}");
                    await Task.Delay(100); // Simulate job execution
                }));

            // Start CronDaemon
            daemon.Start();
            Console.WriteLine($"CronDaemon started at {DateTime.Now}");

            // Wait for user input to stop the program
            Console.WriteLine("Press any key to stop...");
            Console.ReadKey();

            // Stop CronDaemon
            daemon.Stop();
            Console.WriteLine($"CronDaemon stopped at {DateTime.Now}");
            Console.ReadKey();
        }
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6.2

  • .NETStandard 2.0

  • net8.0

  • net9.0

NuGet packages (1)

Showing the top 1 NuGet packages that depend on IceCoffee.Cron:

Package Downloads
IceCoffee.Cron.DependencyInjection

Dependency injection extension for IceCoffee.Cron.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 34 12/19/2024
1.0.2 81 12/14/2024
1.0.1 58 12/14/2024