A libary for creating cronjobs for your application methods.
Currently you have to add this in your Cargo.toml
under [dependencies]
toml
cronjob = { git = "https://github.com/TheUberCatman/cronjob.git" }
This is an example for the unthreaded version.
```Rust extern crate cronjob; use cronjob::{CronJob, gettimezoneoffset};
fn main() {
// Create offset for your required timezone.
let offset = gettimezoneoffset(2);
// Create the CronJob
object.
let mut cron = CronJob::new("Test Cron", "* * * * * * *", offset, oncron);
// Start the cronjob
cron.startjob();
}
// Our cronjob handler fn on_cron(name: &str) { println!("{}: It's time!", name); } ```
This is an example for the threaded version.
```Rust extern crate cronjob; use cronjob::{CronJob, gettimezoneoffset};
fn main() {
// Create offset for your required timezone.
let offset = gettimezoneoffset(2);
// Create the CronJob
object.
let cron = CronJob::new("Test Cron", "* * * * * * *", offset, oncron);
// Start the cronjob
CronJob::startjob_threaded(cron)
}
// Our cronjob handler fn on_cron(name: &str) { println!("{}: It's time!", name); } ```
If you have any issues, please report.