mirror of
https://github.com/egor-white/zaprett.git
synced 2025-12-10 21:40:12 +05:00
add saving logs from nfqws to files
This commit is contained in:
@@ -1,13 +1,20 @@
|
|||||||
use crate::{MODULE_PATH, run_nfqws};
|
use crate::{MODULE_PATH, run_nfqws};
|
||||||
use daemonize::Daemonize;
|
use daemonize::Daemonize;
|
||||||
use log::{error, info};
|
use log::{error, info};
|
||||||
|
use std::fs::File;
|
||||||
|
|
||||||
pub async fn daemonize_nfqws(args: &str) {
|
pub async fn daemonize_nfqws(args: &str) {
|
||||||
info!("Starting nfqws as a daemon");
|
info!("Starting nfqws as a daemon");
|
||||||
|
|
||||||
|
let stdout = File::create(MODULE_PATH.join("tmp/nfqws.out")).unwrap();
|
||||||
|
let stderr = File::create(MODULE_PATH.join("tmp/nfqws.err")).unwrap();
|
||||||
|
|
||||||
let daemonize = Daemonize::new()
|
let daemonize = Daemonize::new()
|
||||||
.pid_file(MODULE_PATH.join("tmp/pid.lock").as_path())
|
.pid_file(MODULE_PATH.join("tmp/pid.lock").as_path())
|
||||||
.working_directory("/tmp")
|
.working_directory("/tmp")
|
||||||
// .group("daemon")
|
// .group("daemon")
|
||||||
|
.stdout(stdout)
|
||||||
|
.stderr(stderr)
|
||||||
.privileged_action(|| "Executed before drop privileges");
|
.privileged_action(|| "Executed before drop privileges");
|
||||||
|
|
||||||
match daemonize.start() {
|
match daemonize.start() {
|
||||||
|
|||||||
Reference in New Issue
Block a user