os:linux:file_watcher_service
Differences
This shows you the differences between two versions of the page.
Last revisionBoth sides next revision | |||
os:linux:file_watcher_service [2020-12-05 00:49] – created Manuel Frei | os:linux:file_watcher_service [2020-12-05 11:27] – Manuel Frei | ||
---|---|---|---|
Line 16: | Line 16: | ||
# | # | ||
file_name="/ | file_name="/ | ||
- | log_file="/ | + | log_file="/ |
+ | lock_file="/ | ||
+ | |||
+ | # check & set lock | ||
+ | exec 200> | ||
+ | flock -n 200 || { echo " | ||
+ | PID=$$ | ||
+ | echo ${PID} 1>& | ||
+ | |||
+ | # file watch | ||
while true; do | while true; do | ||
inotifywait -e modify ${file_name} | inotifywait -e modify ${file_name} | ||
echo " | echo " | ||
- | # maybe do some other actions | + | # maybe do some other actions |
done | done | ||
</ | </ |
os/linux/file_watcher_service.txt · Last modified: 2020-12-05 11:30 by Manuel Frei