bugfix
parent
e9bc8e5043
commit
572fbcd3eb
|
|
@ -2,3 +2,4 @@
|
|||
.idea
|
||||
Dockerfile
|
||||
Cargo.lock
|
||||
settings.json
|
||||
|
|
|
|||
|
|
@ -3,24 +3,16 @@
|
|||
"configServer" : "localhost",
|
||||
"processes": [
|
||||
{
|
||||
"name": "web-server",
|
||||
"path": "/home/vladislav/web/web-server/run.sh",
|
||||
"name": "temp-process",
|
||||
"path": "/home/user/monitor/runner-rs/temp-process",
|
||||
"dependencies": {
|
||||
"files": [
|
||||
{
|
||||
"filename": "control-file",
|
||||
"src": "/home/vladislav/web/",
|
||||
"filename": "dep-file",
|
||||
"src": "/home/user/monitor/runner-rs/tests/examples/",
|
||||
"triggers": {
|
||||
"onDelete": "stop",
|
||||
"onChange": "stop"
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "config-file",
|
||||
"src": "/home/vladislav/web/",
|
||||
"triggers": {
|
||||
"onDelete": "stop",
|
||||
"onChange": "restart"
|
||||
"onChange": "stay"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
@ -29,45 +21,9 @@
|
|||
"hostname": "ya.ru",
|
||||
"port": 443,
|
||||
"triggers": {
|
||||
"wait": 6,
|
||||
"delay": 1,
|
||||
"onLost": "hold"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "temp-process",
|
||||
"path": "/home/vladislav/web/temp-process/run.sh",
|
||||
"dependencies": {
|
||||
"files": [
|
||||
{
|
||||
"filename": "control-file",
|
||||
"src": "/home/vladislav/web/",
|
||||
"triggers": {
|
||||
"onDelete": "hold",
|
||||
"onChange": "stop"
|
||||
}
|
||||
}
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"hostname": "google.com",
|
||||
"port": 443,
|
||||
"triggers": {
|
||||
"wait": 5,
|
||||
"delay": 1,
|
||||
"onLost": "stop"
|
||||
}
|
||||
},
|
||||
{
|
||||
"hostname": "localhost",
|
||||
"port": 8080,
|
||||
"triggers": {
|
||||
"wait": 6,
|
||||
"wait": 10,
|
||||
"delay": 2,
|
||||
"onLost": "stop"
|
||||
"onLost": "hold"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -182,8 +182,11 @@ fn invalid_config_watcher(conn: &mut Connection) -> Processes {
|
|||
|
||||
fn get_remote_config(conn: &mut Connection) -> Option<Processes> {
|
||||
let res: Res = conn.xrevrange_count("config_stream", "+", "-", 1);
|
||||
if res.is_ok() {
|
||||
let config = &res.unwrap()[0];
|
||||
if let Ok(result) = res {
|
||||
if result.is_empty() {
|
||||
return None;
|
||||
}
|
||||
let config = &result[0];
|
||||
if !config.is_empty() {
|
||||
return parse_extern_config(&config[0].1[0].1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,15 +94,15 @@ pub async fn restart_process(name: &str, path: &str) -> Result<(), CustomError>
|
|||
}
|
||||
|
||||
pub async fn start_process(name: &str, path: &str) -> Result<(), CustomError> {
|
||||
// let runsh = format!("{}{}", path, "/run.sh");
|
||||
let mut command = Command::new("bash");
|
||||
command.arg(path);
|
||||
// let runsh = format!("{} {}", "exec", path);
|
||||
let mut command = Command::new(path);
|
||||
// command.arg(path);
|
||||
|
||||
match command.spawn() {
|
||||
Ok(_) => {
|
||||
warn!("Process {} is running now!", name);
|
||||
Ok(())
|
||||
}
|
||||
Err(_) => Err(CustomError::Fatal),
|
||||
Err(er) => {println!("{:?}", er); Err(CustomError::Fatal)},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
./$(pwd)/temp-process
|
||||
/home/user/monitor/runner-rs/temp-process
|
||||
Loading…
Reference in New Issue