-
Notifications
You must be signed in to change notification settings - Fork 0
/
MoreInformation.txt
25 lines (21 loc) · 1.33 KB
/
MoreInformation.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
We can monitor linux directories using "pyinotify".
This documentation will demonstrate how to use a Python script to monitor a directory, you can take reference from it and use as per your convenience.
Clone this repo at "/usr/local/src/" to follow the same steps, path may be vary as differnt clone location and path for python also different for different os.
We need to Install Python 3 and pyinotify to use above script.
Use below commands to install dependencies
For Debian:
apt-get install python3 python3-pip -y
pip3 install pyinotify
For Centos:
yum install epel-release -y
yum install python3 python3-pip -y
pip3 install pyinotify
- I am writing the changes in file "/usr/local/src/output.txt" and monitoring the directory "/usr/local/src/monitor/", any of file will be created and there, it will noted down in output.txt file.
- service file dirwatch.service you can also manage as per your convinience, to use this service file you can copy it to "/etc/systemd/system/" and start stop dirwatch service.
If you're changing path of dirwatch.py or if python3 full path is different, you can manage it accordingly.
More Information:
You may wish to consult the following resources for additional information on this topic.
While these are provided in the hope that they will be useful.
Pyinotify on Github
Pyinotify API documentation
Inotify manpage