Chd.Library.Services 9.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package Chd.Library.Services --version 9.0.5                
NuGet\Install-Package Chd.Library.Services -Version 9.0.5                
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="Chd.Library.Services" Version="9.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Chd.Library.Services --version 9.0.5                
#r "nuget: Chd.Library.Services, 9.0.5"                
#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 Chd.Library.Services as a Cake Addin
#addin nuget:?package=Chd.Library.Services&version=9.0.5

// Install Chd.Library.Services as a Cake Tool
#tool nuget:?package=Chd.Library.Services&version=9.0.5                

Service library for .Net Core

Chd (cleverly handle difficulty) library helps you cleverly handle difficulty, writing code fastly and do your application stable.

πŸ“ Table of Contents

🧐 About

Cron syntax is used to schedule when jobs should run. You may need to use a cron syntax string to create a pipeline schedule, or to prevent unintentional releases by setting a deploy freeze.

🏁 Getting Started

Before setting up cron jobs, you must understand cron’s syntax and formatting to ensure the script runs properly. The crontab syntax consists of five fields with the following possible values:

  • Minute. The minute of the hour the command will run, ranging from 0-59.

  • Hour. The hour the command will run, ranging from 0-23 in a 24-hour notation.

  • Day of the month. The date of the month the user wants the command to run, ranging from 1-31.

  • Month. The month that the user wants the command to run. It ranges from 1-12, representing January until December.

  • Day of the week. The day of the week for a command to run, ranging from 0-6. The value represents Sunday-Saturday. In some systems, the value 7 represents Sunday.

In addition to the syntax, you must understand the cron job operators to modify the value in each field. You must properly use these operators in all crontab files to ensure your commands run:

  • Asterisk (*). This operator signifies all possible values in a field. For example, write an asterisk in the Minute field to make the cron job run every minute.

  • Comma (,). An operator for listing multiple values. For example, writing 1,5 in the day-of-week field will schedule the job to run every Monday and Friday.

  • Hyphen (-). Users can determine a range of values. Write 6-9 in the Month field to set up a cron job from June to September.

  • Separator (/). This separator divides a value. If you want to run a script every twelve hours, write */12 in the Hour field.

  • Last (L). Users can use this operator in the day-of-month and day-of-week fields. For example, writing 3L in the day-of-week field means the last Wednesday of the month.

  • Weekday (W). An operator that determines the closest weekday from a given time. For example, if the 1st of a month is a Saturday, writing 1W in the day-of-month field will run the command on Monday the 3rd.

  • Hash (#). An operator for the day-of-week field that determines a specific day of the month, using a number between 1 to 5. For instance, 1#2 means the second Monday of the month.

  • Question mark (?). This operator inputs no specific value for the day-of-month and day-of-week fields. It’s typically replaced with the cron daemon start-up time.


A CRON expression is a string representing the schedule for a particular command to execute. The parts of a CRON schedule are as follows:

*    *    *    *    *    *
-    -    -    -    -    -
|    |    |    |    |    |
|    |    |    |    |    + year [optional]
|    |    |    |    +----- day of week (0 - 7) (Sunday=0 or 7)
|    |    |    +---------- month (1 - 12)
|    |    +--------------- day of month (1 - 31)
|    +-------------------- hour (0 - 23)
+------------------------- min (0 - 59)

🎈 Usage

πŸ”§ Create Cron Job Service Class

We need a class created by inheriting from the "CronJobService" class.


   [CronJob("*/1 * * * *")]  //once a minute
    public class SampleCronJobService : CronJobService
    {
        public override void Run(CancellationToken cancellationToken)
        {
         //Write code here
        }
    }

πŸ’‰ Injection Service To Application

We need to inject the class we created above into the application. In this way, our service is ready.

             var builder = WebApplication.CreateBuilder(args);
             builder.Services.AddCronJobService<SampleCronJobService>();

After running the application, the service's "Run" method work once a minute.

✍️ Authors

See also the list of contributors who participated in this project.

πŸŽ‰ Acknowledgements

Thank you for using my library.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
9.0.7 46 1/30/2025
9.0.6 72 1/17/2025
9.0.5 64 1/17/2025
9.0.4 71 1/16/2025
9.0.3 81 12/30/2024
8.0.8 84 12/23/2024
8.0.4 79 12/23/2024
8.0.2 75 12/23/2024
7.0.5 232 11/25/2023
7.0.4 196 8/9/2023
0.0.3 165 6/6/2023