Crates.io | tiny-native-scheduler |
lib.rs | tiny-native-scheduler |
version | 0.1.1 |
source | src |
created_at | 2023-03-04 17:28:07.152287 |
updated_at | 2023-03-04 18:38:45.358537 |
description | Tiny helper to schedule tasks to run at a specific time using `at` on Unix and `schtasks` on Windows. |
homepage | https://github.com/Araxeus/tiny-native-scheduler |
repository | https://github.com/Araxeus/tiny-native-scheduler |
max_upload_size | |
id | 800728 |
size | 9,238 |
cargo install tiny_scheduler
Or add this to your Cargo.toml
:
[dependencies]
tiny_scheduler = "0.1.0"
use tiny_scheduler::execute_command_in_x_minutes;
fn main() {
execute_command_in_x_minutes("cargo install tiny_scheduler", 2);
}
execute_command_in_x_minutes
Execute a command in x minutes using at
or schtasks
depending on the OS.
command
- The command to execute.minutes
- The amount of minutes to wait before executing the command.win_task_name
- The name of the task to create on Windows.use execute_command_in_x_minutes::execute_command_in_x_minutes;
execute_command_in_x_minutes("cargo install cargo-update", 5).unwrap();
This function will return an error if the command fails to execute.