Skip to content

tatatakky/kanshi-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kanshi

kanshi is a simple tool like Monit for monitoring file timestamp.

why kanshi ?

Japanese kanshi(監視) means monitoring.

Usage

use kanshi_rs::kanshi::Kanshi;
use kanshi_rs::script;
fn main() {
    let kanshi = Kanshi::new("/your/target/monitored/file.pid");
    kanshi.every(3).lazy_exec(|| script("/your/execution/command"));
}

if timestamp of target file is changed, execute some script.
In the above program, the target file is monitored every 3 seconds.
And then, you can get log in /var/log/kanshi.log like the following.

$ tail -f /var/log/kanshi.log
Wed Sep 28 15:23:50 2022 Kanshi[INFO] Start to do monitoring File Timestamp!
Wed Sep 28 15:27:37 2022 Kanshi[INFO] File Timestamp is changed now, then execute script!

Sample

https://github.com/tatatakky/kanshi-rs-sample

About

kanshi is a monitoring tool written by Rust.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages