BinaryCoffee.SchedulingTask 1.0.4

dotnet add package BinaryCoffee.SchedulingTask --version 1.0.4
                    
NuGet\Install-Package BinaryCoffee.SchedulingTask -Version 1.0.4
                    
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="BinaryCoffee.SchedulingTask" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BinaryCoffee.SchedulingTask" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="BinaryCoffee.SchedulingTask" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BinaryCoffee.SchedulingTask --version 1.0.4
                    
#r "nuget: BinaryCoffee.SchedulingTask, 1.0.4"
                    
#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.
#:package BinaryCoffee.SchedulingTask@1.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BinaryCoffee.SchedulingTask&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=BinaryCoffee.SchedulingTask&version=1.0.4
                    
Install as a Cake Tool

☕ ScheduleYourTask

Crontab is a task scheduling tool on Unix and Linux operating systems that allows for programming the execution of commands at specific times, either repeatedly or at a one-time occurrence.

The basic syntax of a Crontab command consists of five fields separated by spaces that define the time of execution:

  • Minute (0-59)
  • Hour (0-23)
  • Day of the Month (1-31)
  • Month (1-12)
  • Day of the Week (0-6, where 0 is Sunday)

For example:

0 12 * * *

This command will execute a task every day at 12:00 PM.

⏰ Common Usage Patterns

  • Repeating tasks: Execute tasks at regular intervals (e.g., every minute, hour, day, week, or month).
  • Specific days and times: Run tasks at precise schedules (e.g., weekdays at 9:00 AM).
  • Complex schedules: Combine fields for advanced timing (e.g., every weekday at 9:00 AM and 5:00 PM).

Crontab simplifies system administration and automates routine tasks, making workflows more efficient.

☕ BinaryCoffee.ScheduleYourTask

BinaryCoffee.ScheduleYourTask is a .NET package that brings the power of Crontab scheduling to the .NET platform. It enables developers to interact with crontab configurations programmatically.

Features ✨

  • Retrieve existing crontab entries.
  • Add or remove tasks with unique identifiers.
  • Enable or disable tasks dynamically.
  • Export or import crontab configurations.
  • Track changes and maintain backups of crontab files.

🚀 How to Use the Package

  1. Include the package in your project: Install from NuGet: BinaryCoffee.ScheduleYourTask

  2. Declare the namespace:

    using SchedulingTasks;
    
  3. Access the functionality: Use methods like Crontab.GetCrontab() to interact with crontab entries programmatically.

Example Usage 💻

Retrieve Existing Tasks
using SchedulingTasks;

// Retrieve existing tasks
var tasks = Crontab.GetCrontab();
Console.WriteLine("Current Crontab Entries:");
Console.WriteLine(tasks);
Add a New Task
using SchedulingTasks;

// Add a new task to run a script daily at 2 AM
string task = "0 2 * * * /path/to/your/script.sh";
Crontab.AddTask(task);
Console.WriteLine("Task added successfully.");
Remove a Task
using SchedulingTasks;

// Remove a task using its unique identifier
string taskIdentifier = "your-unique-identifier";
Crontab.RemoveTask(taskIdentifier);
Console.WriteLine("Task removed successfully.");
Enable or Disable a Task
using SchedulingTasks;

// Enable a task
string taskIdentifier = "your-unique-identifier";
Crontab.EnableDisableTask(taskIdentifier, true);
Console.WriteLine("Task enabled successfully.");

// Disable a task
Crontab.EnableDisableTask(taskIdentifier, false);
Console.WriteLine("Task disabled successfully.");
Export Tasks to a File
using SchedulingTasks;

// Export crontab configuration to a file
string filePath = "/path/to/exported_crontab.txt";
Crontab.ExportTasks(filePath);
Console.WriteLine($"Crontab exported to {filePath}.");
Import Tasks from a File
using SchedulingTasks;

// Import tasks from a file
string filePath = "/path/to/imported_crontab.txt";
Crontab.ImportTasks(filePath);
Console.WriteLine("Crontab imported successfully.");
Track Changes and Create Backups
using SchedulingTasks;

// Track changes to crontab
Crontab.TrackCrontabChanges();
Console.WriteLine("Crontab changes tracked and backup created.");

📖 Documentation

Methods Available

  • Crontab.GetCrontab(): Retrieves the current crontab configuration.

  • Crontab.AddTask(string task): Adds a new task to the crontab.

  • Crontab.RemoveTask(string taskIdentifier): Removes a task by its unique identifier.

  • Crontab.EnableDisableTask(string taskIdentifier, bool enable): Enables or disables a task by toggling comments.

  • Crontab.ExportTasks(string filePath): Exports the crontab configuration to a file.

  • Crontab.ImportTasks(string filePath): Imports tasks from a crontab file.

  • Crontab.TrackCrontabChanges(): Tracks changes to crontab by creating timestamped backups.

📌 Stickers for Enrichment

  • ⏰ Scheduling made simple.
  • 💻 .NET Integration for Crontab.
  • 🚀 Automate your workflows effortlessly.
  • 📂 Manage your tasks programmatically.

🛠️ Contributing

Feel free to contribute by submitting issues or pull requests to the GitHub Repository.


Made with ☕ by BinaryCoffee.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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 was computed.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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.
  • .NETStandard 2.1

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.

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
1.0.4 177 1/12/2025
1.0.3 370 3/25/2023

Added icon, external libraries, and update references