diff options
Diffstat (limited to 'src/systemd')
-rw-r--r-- | src/systemd/journal.rs | 10 | ||||
-rw-r--r-- | src/systemd/mod.rs | 1 |
2 files changed, 11 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()) +} diff --git a/src/systemd/mod.rs b/src/systemd/mod.rs index a5acbce..bc1a9a1 100644 --- a/src/systemd/mod.rs +++ b/src/systemd/mod.rs @@ -1 +1,2 @@ pub mod unit; +pub mod journal; |