Skip to content
Snippets Groups Projects
Commit a8924be6 authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- added daemon mode using inotifywait

parent 74e2248f
No related branches found
No related tags found
No related merge requests found
......@@ -397,8 +397,17 @@ if [ "$WITH_PIPE" -eq 1 ]; then
rm -f "$filename" || error "could not remove temporary file '$filename'"
else
if [ "$WITH_DAEMON" -eq 1 ]; then
# TODO: protect DAEMON from STRG-C for clean shutdown
# echo daemon mode, use inotify to watch changes
debug "starting daemon"
scan_dir "$WATCH_FOLDER" # to clean up existing files
/usr/bin/inotifywait --monitor --recursive --event create \
--event attrib --event moved_to --format "%w%f" "$WATCH_FOLDER" \
| while read -r filename; do
debug "called inotifywait using /usr/bin/inotifywait --monitor
--recursive --event create --event attrib --event moved_to --format '%f' $WATCH_FOLDER"
scan_file "$filename"
done
debug "stopping daemon"
else
# cli mode, scan watch folder once
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment