diff --git a/src/main.rs b/src/main.rs index 35a5b9d..72f8cb8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,8 +39,8 @@ struct Cli { /// How many backups to keep #[arg(short = 'n', long, default_value_t = 7)] max_backups: u64, - /// How frequently to perform a backup, in minutes - #[arg(short = 't', long, default_value_t = 720)] + /// How frequently to perform a backup, in minutes; 0 to disable. + #[arg(short = 't', long, default_value_t = 0)] frequency: u64, } @@ -69,8 +69,10 @@ fn main() { .max_backups(cli.max_backups); let counter = Arc::new(Mutex::new(cmd.spawn().expect("Failed to start server."))); - let clone = Arc::clone(&counter); - std::thread::spawn(move || backups_thread(clone, cli.frequency)); + if cli.frequency > 0 { + let clone = Arc::clone(&counter); + std::thread::spawn(move || backups_thread(clone, cli.frequency)); + } let stdin = io::stdin(); let input = &mut String::new();