feat: ability to disable backup thread
parent
3c5cdaef4f
commit
f083d7e701
|
@ -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.")));
|
||||
|
||||
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();
|
||||
|
|
Loading…
Reference in New Issue