Merge pull request 'Minor changes.' (#7) from v1 into master
Reviewed-on: https://www.cainet.info/git/cai/CAI-Watchdog/pulls/7
This commit is contained in:
commit
c3a572619f
@ -4,9 +4,13 @@ Watchdog for monitoring web-services
|
||||
|
||||
## Requirements
|
||||
|
||||
**On \*nix:** OpenSSL 1.0.1, 1.0.2, 1.1.0, or 1.1.1 with headers (see https://github.com/sfackler/rust-openssl)
|
||||
###On \*nix
|
||||
- OpenSSL 1.0.1, 1.0.2, 1.1.0, or 1.1.1 with headers (see https://github.com/sfackler/rust-openssl)
|
||||
- Perl
|
||||
- Curl
|
||||
|
||||
**On Windows:** Nothing
|
||||
###On Windows
|
||||
- PowerShell
|
||||
|
||||
## Configuration file
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ Description=Watchdog service
|
||||
User=wwwrun
|
||||
Group=www
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/cai-watchdog
|
||||
ExecStart=/usr/local/sbin/cai-watchdog
|
||||
|
||||
KillMode=control-group
|
||||
NotifyAccess=all
|
||||
10
src/main.rs
10
src/main.rs
@ -3,9 +3,10 @@ extern crate ini;
|
||||
extern crate exitcode;
|
||||
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use std::process::Command;
|
||||
|
||||
/// Rule description structure
|
||||
pub struct Rule {
|
||||
@ -161,6 +162,13 @@ fn main() {
|
||||
"/etc/cai-watchdog.conf"
|
||||
};
|
||||
|
||||
if !Path::new(cfg_file).exists() {
|
||||
println!("Error! Can't find configuration file.");
|
||||
println!("Exiting...");
|
||||
|
||||
std::process::exit(exitcode::CONFIG);
|
||||
}
|
||||
|
||||
let cfg = ini!(cfg_file);
|
||||
|
||||
let check_interval = cfg["main"]["check_interval"].clone().unwrap().parse::<u64>().unwrap() * 1000;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user