diff options
Diffstat (limited to 'src/systemd/journal.rs')
-rw-r--r-- | src/systemd/journal.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/systemd/journal.rs b/src/systemd/journal.rs new file mode 100644 index 0000000..86791ab --- /dev/null +++ b/src/systemd/journal.rs @@ -0,0 +1,10 @@ +use std::process::Command; +use std::io; + +pub fn get_log(unit: &str, lines: i32) -> io::Result<String> { + let status = try!(Command::new("journalctl") + .args(&["-u", unit, + "-n", &lines.to_string()]) + .output()); + Ok(String::from_utf8_lossy(&status.stdout).into_owned()) +} |