Crates.io | cron_manager |
lib.rs | cron_manager |
version | 0.1.1 |
source | src |
created_at | 2024-07-23 11:32:02.597627 |
updated_at | 2024-10-17 14:20:07.563232 |
description | A simple manager to add/remove cronjobs |
homepage | |
repository | https://github.com/buhaytza2005/cron_manager |
max_upload_size | |
id | 1312681 |
size | 29,320 |
A simple manager to add/remove cronjobs
use cron_manager::cron_manager::{CronJob, CronManager};
use rand::Rng;
fn main() {
let mut manager = CronManager::new();
for (i, job) in manager.list_jobs().iter().enumerate() {
println!("{}: {}", i, job);
}
manager.add_job(CronJob {
schedule: "* * * * *".to_string(),
command: "/bin/echo hello > /tmp/hello".to_string(),
comment: Some("testing".to_string()),
});
manager.add_job(CronJob {
schedule: "* * * * *".to_string(),
command: "/bin/echo hello > /tmp/hello".to_string(),
comment: Some("testing".to_string()),
});
manager.remove_job(0);
manager.remove_job_by_comment("testing");