aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeer <himbeerserverde@gmail.com>2024-02-19 14:53:12 +0100
committerHimbeer <himbeerserverde@gmail.com>2024-02-19 14:53:12 +0100
commitd5bfd77859ed42b0bb99616035807cd40194865f (patch)
tree6588b47d176f8c1d58262b54721da652a99404ab
parent734888d4e3218be31c310517d4902011e7eb11dc (diff)
print progress messages to stderr instead of stdout
-rw-r--r--hbak/src/main.rs24
-rw-r--r--hbakd/src/main.rs14
2 files changed, 19 insertions, 19 deletions
diff --git a/hbak/src/main.rs b/hbak/src/main.rs
index 052be20..27d3cad 100644
--- a/hbak/src/main.rs
+++ b/hbak/src/main.rs
@@ -289,7 +289,7 @@ fn logic() -> Result<()> {
return Err(LocalNodeError::ForeignSubvolume(subvol.clone()).into());
}
- println!("Snapshotting {}...", subvol);
+ eprintln!("Snapshotting {}...", subvol);
local_node.snapshot_now(subvol.clone(), incremental)?;
}
}
@@ -306,7 +306,7 @@ fn logic() -> Result<()> {
.iter()
.filter(|item| remote_nodes.is_empty() || remote_nodes.contains(&item.address))
{
- println!("Synchronizing with {}...", remote_node.address);
+ eprintln!("Synchronizing with {}...", remote_node.address);
sync(&local_node, remote_node, &push, &pull)?;
}
}
@@ -334,9 +334,9 @@ fn logic() -> Result<()> {
)?;
if let Some(address) = &address {
- println!("Restoring from {}...", address);
+ eprintln!("Restoring from {}...", address);
} else {
- println!("Restoring locally...");
+ eprintln!("Restoring locally...");
}
restore(&local_node, address.as_deref(), no_restore, ignore_fstab)?;
@@ -371,7 +371,7 @@ fn sync(
&local_node.config().passphrase,
)?;
- println!("Authentication to {} successful", remote_node.address);
+ eprintln!("Authentication to {} successful", remote_node.address);
let mut local_sync_info = SyncInfo {
volumes: HashMap::new(),
@@ -414,7 +414,7 @@ fn sync(
}
for (_, snapshot) in &tx {
- println!(
+ eprintln!(
"Queueing {} for transmission to {}",
snapshot, remote_node.address
);
@@ -435,7 +435,7 @@ fn sync(
let file = File::create(snapshot.streaming_path(Mode::Client))
.map_err(|_| RemoteError::RxError)?;
- println!("Receiving {} from {}", snapshot, remote_node.address);
+ eprintln!("Receiving {} from {}", snapshot, remote_node.address);
Ok(file)
};
@@ -447,7 +447,7 @@ fn sync(
)
.map_err(|_| RemoteError::RxError)?;
- println!("Received {} from {}", snapshot, remote_node.address);
+ eprintln!("Received {} from {}", snapshot, remote_node.address);
Ok(())
};
@@ -477,7 +477,7 @@ fn restore(
&local_node.config().passphrase,
)?;
- println!("Authentication to {} successful", address);
+ eprintln!("Authentication to {} successful", address);
let mut local_sync_info = SyncInfo {
volumes: HashMap::new(),
@@ -509,13 +509,13 @@ fn restore(
local_node.recover().map_err(|_| RemoteError::RxError)?;
children.lock().unwrap().insert(snapshot.clone(), child);
- println!("Receiving {} from {}", snapshot, address);
+ eprintln!("Receiving {} from {}", snapshot, address);
Ok(recovery_stream)
};
let rx_finish = |snapshot: Snapshot| {
- println!("Received {} from {}", snapshot, address);
+ eprintln!("Received {} from {}", snapshot, address);
let mut child = children
.lock()
@@ -549,7 +549,7 @@ fn restore(
for subvol in &local_node.config().subvols {
ensure_unmounted(subvol.clone())?;
- println!("Restoring subvolume {}", subvol);
+ eprintln!("Restoring subvolume {}", subvol);
local_node.restore(subvol.clone(), ignore_fstab)?;
}
}
diff --git a/hbakd/src/main.rs b/hbakd/src/main.rs
index 1b6dcde..a2bd06a 100644
--- a/hbakd/src/main.rs
+++ b/hbakd/src/main.rs
@@ -66,7 +66,7 @@ fn serve(debug: bool) -> Result<()> {
ctrlc::set_handler(move || {
if debug {
- println!("[info] Caught SIGINT, SIGTERM or SIGHUP, exiting");
+ eprintln!("[info] Caught SIGINT, SIGTERM or SIGHUP, exiting");
}
should_exit2.store(true, Ordering::SeqCst);
@@ -86,7 +86,7 @@ fn serve(debug: bool) -> Result<()> {
listener.set_nonblocking(true)?;
if debug {
- println!("[info] <{}> Listening", bind_addr);
+ eprintln!("[info] <{}> Listening", bind_addr);
}
for stream in listener.incoming() {
@@ -101,7 +101,7 @@ fn serve(debug: bool) -> Result<()> {
thread::spawn(move || {
match handle_client(debug, &local_node, stream) {
Ok(_) if debug => {
- println!("[info] <{}> Disconnected", peer_addr)
+ eprintln!("[info] <{}> Disconnected", peer_addr)
}
Ok(_) => {}
Err(e) if debug => {
@@ -139,7 +139,7 @@ fn handle_client(debug: bool, local_node: &LocalNode, stream: TcpStream) -> Resu
auth_serv.secure_stream(local_node.config().auth.clone())?;
if debug {
- println!(
+ eprintln!(
"[info] <{}@{}> Authentication successful",
remote_node_auth.node_name, peer_addr
);
@@ -201,7 +201,7 @@ fn handle_client(debug: bool, local_node: &LocalNode, stream: TcpStream) -> Resu
if debug {
for (_, snapshot) in &tx {
- println!(
+ eprintln!(
"[info] <{}@{}> Queueing {} for transmission",
remote_node_auth.node_name, peer_addr, snapshot
);
@@ -224,7 +224,7 @@ fn handle_client(debug: bool, local_node: &LocalNode, stream: TcpStream) -> Resu
.map_err(|_| RemoteError::RxError)?;
if debug {
- println!(
+ eprintln!(
"[info] <{}@{}> Receiving {}",
remote_node_auth.node_name, peer_addr, snapshot
);
@@ -241,7 +241,7 @@ fn handle_client(debug: bool, local_node: &LocalNode, stream: TcpStream) -> Resu
.map_err(|_| RemoteError::RxError)?;
if debug {
- println!(
+ eprintln!(
"[info] <{}@{}> Received {}",
remote_node_auth.node_name, peer_addr, snapshot
);