Minor changes. #7

Merged
cai merged 1 commits from v1 into master 2022-06-28 01:36:43 +03:00
5 changed files with 16 additions and 4 deletions

View File

@ -4,9 +4,13 @@ Watchdog for monitoring web-services
## Requirements ## 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 ## Configuration file

View File

@ -5,7 +5,7 @@ Description=Watchdog service
User=wwwrun User=wwwrun
Group=www Group=www
Type=simple Type=simple
ExecStart=/usr/local/bin/cai-watchdog ExecStart=/usr/local/sbin/cai-watchdog
KillMode=control-group KillMode=control-group
NotifyAccess=all NotifyAccess=all

View File

@ -3,9 +3,10 @@ extern crate ini;
extern crate exitcode; extern crate exitcode;
use std::env; use std::env;
use std::path::Path;
use std::process::Command;
use std::thread; use std::thread;
use std::time::Duration; use std::time::Duration;
use std::process::Command;
/// Rule description structure /// Rule description structure
pub struct Rule { pub struct Rule {
@ -161,6 +162,13 @@ fn main() {
"/etc/cai-watchdog.conf" "/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 cfg = ini!(cfg_file);
let check_interval = cfg["main"]["check_interval"].clone().unwrap().parse::<u64>().unwrap() * 1000; let check_interval = cfg["main"]["check_interval"].clone().unwrap().parse::<u64>().unwrap() * 1000;